android-spinner

Android: Cannot style spinner divider

蓝咒 提交于 2019-12-17 16:10:22
问题 I'm trying to create a theme for my first Android app, and it is driving me round the bend. I finally managed to figure out how to style items in a dropdown list, but now I can't change the colour of the divider between list items. I have searched similar questions on stackoverflow, and tried dozens of combinations, but nothing seems to work. Here is my styles.xml file (abbreviated for clarity): <?xml version="1.0" encoding="utf-8"?> <resources> <style name="MyTheme" parent="android:Theme

Create a progressDialog only with the spinner (in the middle)

北战南征 提交于 2019-12-17 15:39:16
问题 I need to create a progressDialog only with the spinner and without the box (or at least with a smaller box and the image in the middle). I don't want to add a spinner to my .xml (layout file) to load the spinner. Is there any way to accomplish this? Thanks! 回答1: try this way: pd = new ProgressDialog(Login.this,R.style.MyTheme); pd.setCancelable(false); pd.setProgressStyle(android.R.style.Widget_ProgressBar_Small); pd.show(); And create Theme in values\styles.xml <style name="MyTheme" parent=

Android spinner with date picker, like Google Calendar app

我们两清 提交于 2019-12-17 15:23:54
问题 I'm trying to get a text box that looks like a spinner to activate a date picker dialog. This is done in both the Google Calendar app and the Contacts app (for birthdate) on ICS. Do I need to use a spinner, and if so how do I change it's input view to be a date picker? Or if not, how do I get a text view to have the little triangle that usually indicates a spinner? 回答1: Twaddington's comment on his answer is actually the right approach. What you need is to create a text view and apply the

Change colour of small triangle on spinner in android

风格不统一 提交于 2019-12-17 10:21:40
问题 How can I change the colour of small triangle at the bottom right corner of spinner like shown in the image? It is showing default grey colour right now. like this 回答1: To get the correct images, you can go to Android Asset Studio site and choose the Android Holo Colors Generator. This will create all the assets you might need, including the "triangle". It also generates the XML files that implement the changes. Here are the example XML files: Custom Color: <?xml version="1.0" encoding="utf-8

Spinner: get state or get notified when opens

放肆的年华 提交于 2019-12-16 22:45:34
问题 Is it possible to know whether a Spinner is open or closed? It would even be better if there was some sort of onOpenListener for Spinners. I've tried using an OnItemSelectedListener like this: spinnerType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { executeSomething(); } @Override public void onNothingSelected(AdapterView<?> parent) { Log.d("nothing" , "selected"); } }); I

Spinner does not apply dropDownSelector attribute

流过昼夜 提交于 2019-12-14 04:16:10
问题 I'm using spinner and want to add spinner - to change behavior depends of states(focused, pressed) sample project is here https://github.com/vovs/spinner_issue My code: activity_main.xml <Spinner android:id="@+id/spinner" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="30dp" android:spinnerMode="dropdown" android:dropDownSelector="@drawable/spinner_state" /> spinner

Android extended Spinner is not responding to tap events and missing arrow

坚强是说给别人听的谎言 提交于 2019-12-14 04:04:37
问题 I want to use a centered spinner where the width of the spinner is only as wide as the selected item text. From my research it seems that this is not natively supported out of the box with an attribute so I found another StackOverflow question/answer and tried implementing that but ran into some issues with it. So I took option 1 from this SO response and implemented it in Kotlin and It's not working for me class DynamicWidthSpinner @JvmOverloads constructor( context: Context, attrs:

Android Spinner Error

跟風遠走 提交于 2019-12-14 03:26:40
问题 hello I try to put in my java Code a Spinner, but it shows in the else if statement error: private EditText textName; private EditText textContent; private Spinner CategorySpinner; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_text); configureButton1(); configureButton2(); textName = (EditText) findViewById(R.id.editTextName); textContent = (EditText) findViewById(R.id.editContent); CategorySpinner =

Populating a Spinner with keys from a Firebase database, then another Spinner from the first's selection

↘锁芯ラ 提交于 2019-12-13 23:53:14
问题 I want to get all of the "Group No" keys in a single Spinner , then all of the "School No" keys of the selected "Group No" in a second Spinner . Here's my database: Here's my Java code: public class Collection extends AppCompatActivity { TextView ttl, tgat, tsch; Button btnshw, btngt; Spinner sping; DatabaseReference d2ref; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_collection); tgat = (TextView)

How to display two Spinners with linked data?

拈花ヽ惹草 提交于 2019-12-13 23:49:09
问题 I want to populate the Spinner-2 on basis of Spinner-1 . For example if I select Newton then Spinner-2 will show only Force and Apple and not the other values and if I select Hiiii only ds should populate on the Spinner-2. This is just an example which I am showing in the image below(all values are dynamic in the original app). Where ever there is any value selected in spinner-1 the value with the determined tag should be populated in the spinner-2. UPDATE-3 MainActivity.java public class