Questions tagged [spinner]

Spinner is a widget that allows the user to select an item from a group, like a dropdown list.

A Spinner is a widget that allows the user to select an item from a group. It is similar to a dropdown list and will allow scrolling when the list exceeds the available vertical space on the screen.

Initial help

Code sample

Android design guide

5148 questions
81
votes
8 answers

Android: Where is the Spinner widget's text color attribute hiding?

I'm trying to change the text color of the single item that is displayed in the spinner button after you select an item from the dropdown. I've been perusing the themes.xml and styles.xml in the Android SDK for an hour now, and I can't seem to find…
Christopher Perry
  • 38,891
  • 43
  • 145
  • 187
77
votes
11 answers

How do I create an Android Spinner as a popup?

I want to bring up a spinner dialog when the user taps a menu item to allow the user to select an item. Do I need a separate dialog for this or can I use Spinner directly? I see this link, mentions a MODE_DIALOG option but it doesn't seem to be…
Edwin Evans
  • 2,726
  • 5
  • 34
  • 47
77
votes
5 answers

Disabling Spinner in android

I'm having problems when using android:enabled="false", it's not disabling the component in the case it's a spinner. Don't know if it's relevant, but it belongs to a layout that's part of a viewflipper. Any hints or workarounds ? Thanks
xain
  • 13,159
  • 17
  • 75
  • 119
75
votes
14 answers

How to add a Hint in spinner in XML

I am trying to add a Hint in the spinner widget as there is no option of Hint as in EditText, I want to show Gender as a Hint and when clicked it must show only Male and Female not the hint. How it can be Done Only Using XML XML code of spinner. …
A-JaY
  • 781
  • 1
  • 5
  • 7
74
votes
11 answers

Change spinner background color but keep arrow

I've read several thing about it but I can't find what I need. I want to keep the grey arrow but I want to remove the horizontal bar from the default style and have a white background. Do you have any idea of how I can do this ? Here is what I have…
Mansur Khan
  • 1,675
  • 1
  • 12
  • 24
69
votes
15 answers

Spinner does not wrap text -- is this an Android bug?

If the text of a Spinner item is too long to fit into a single line, the text is not wrapped but cut off. This is only the case for API level >= 11. Here are screenshots of Android 4.2.2 (left) which shows the wrong behavior and Android 2.3.3…
Matthias Robbers
  • 15,689
  • 6
  • 63
  • 73
67
votes
6 answers

Android Spinner with different layouts for "drop down state" and "closed state"?

I have an Android Spinner view in my layout. I would like that spinner to show only a single text item when closed, but when the user clicks on it (i.e. opens the spinner dialog) I would like to show more extensive information for each item,…
dbm
  • 10,376
  • 6
  • 44
  • 56
66
votes
6 answers

How to set Spinner Default by its Value instead of Position?

I have 1-50 records in the database. I am fetching those data using cursor and set those values to Spinner using Simple Cursor Adapter. Now what i need is i want to set one value say 39th value as default. But not by its position i want to set by…
vinothp
  • 9,939
  • 19
  • 61
  • 103
65
votes
8 answers

Android Kotlin onItemSelectedListener for spinner not working

I have a spinner with some items (strings). I want to add the selected items to a list. I read online that I should use the onItemSelectedListenerrather than the onItemClickListener. I implemented this but I don't know how to complete the step of…
DukeAmber27
  • 671
  • 1
  • 5
  • 3
61
votes
25 answers

Angular Material mat-spinner custom color

Does anyone know how can I change mat-spinner color in Angular Material? Overriding css doesn't work. I tried changing color in material files but they can only be imported, I can't change anything there. I want it to be my custom color, not color…
mavrise
  • 611
  • 1
  • 5
  • 5
56
votes
3 answers

Is it possibile to set hint Spinner in Android

Is there anyway of making a hint for a spinner similar to hint that is provided for edit text fields. I know you can use a prompt that gives you a title bar but still leaves the initial spinner field blank until you click into the spinner. I…
Nick
  • 9,285
  • 33
  • 104
  • 147
56
votes
11 answers

Spinner : onItemSelected not called when selected item remains the same

I have a OnItemSelectedListener for my Spinner, but it is not called when the selected item is the same as the previous one. Apparently the OnClickListener is not an option for a Spinner. I need to catch everytime a user click on an item. Any…
elgui
  • 3,303
  • 4
  • 28
  • 37
55
votes
4 answers

Android - Remove Spinner Dropdown Arrow

I'm just wondering if it's at all possible to simply remove the dropdown arrow for a spinner? I have a drawable arrow in a backgroud layout for my spinner, however the system default arrow appears to the right of the spinner, which I would like to…
55
votes
11 answers

Android: setSelection having no effect on Spinner

I'm having some problems with setSelection on a Spinner. I set the value to be pre-selected when the spinner is shown in code, but it has no effect and the first alternative in the list is always selected. The code looks like this: LayoutInflater li…
aspartame
  • 4,622
  • 7
  • 36
  • 39
53
votes
9 answers

How to make rounded border for dropdownbutton in flutter?

How to Add Rounded Rectangle Border? Below Code didn't result in any border on screen. Container(margin: EdgeInsets.only(top: 10.0, right: 10.0, left: 10.0), width: double.infinity, // decoration: ShapeDecoration( // shape:…
John Ravi
  • 1,190
  • 1
  • 12
  • 21