Questions tagged [android-spinner]

A spinner is a control/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

Design guide

3548 questions
606
votes
36 answers

How to make an Android Spinner with initial text "Select One"?

I want to use a Spinner that initially (when the user has not made a selection yet) displays the text "Select One". When the user clicks the spinner, the list of items is displayed and the user selects one of the options. After the user has made a…
Pieter Kuijpers
  • 7,247
  • 5
  • 28
  • 36
453
votes
17 answers

Android Spinner: Get the selected item change event

How can you set the event listener for a Spinner when the selected item changes? Basically what I am trying to do is something similar to this: spinner1.onSelectionChange = handleSelectionChange; void handleSelectionChange(Object sender){ …
Soni Ali
  • 18,464
  • 16
  • 44
  • 53
441
votes
33 answers

How to keep onItemSelected from firing off on a newly instantiated Spinner?

I've thought of some less than elegant ways to solve this, but I know I must be missing something. My onItemSelected fires off immediately without any interaction with the user, and this is undesired behavior. I wish for the UI to wait until the…
FauxReal
  • 4,762
  • 4
  • 21
  • 18
424
votes
13 answers

Get spinner selected items text?

How to get spinner selected item's text? I have to get the text on the item selected in my spinner when i click on the save button. i need the text not the Index.
Harinder
  • 11,776
  • 16
  • 70
  • 126
272
votes
14 answers

How to create a drop-down list?

How can I create a drop-down list? I've tried a ScrollView but it's not exactly what I need.
user1820528
  • 2,837
  • 3
  • 15
  • 10
207
votes
21 answers

Android Spinner : Avoid onItemSelected calls during initialization

I created an Android application with a Spinner and a TextView. I want to display the selected item from the Spinner's drop down list in the TextView. I implemented the Spinner in the onCreate method so when I'm running the program, it shows a value…
Grant
  • 4,413
  • 18
  • 56
  • 82
171
votes
6 answers

How to customize a Spinner in Android

I want to add a custom height to the dropdown of a Spinner, say 30dp, and I want to hide the dividers of the dropdown list of Spinner. So far I tried to implement following style to the Spinner: