JuiCe JuiCe - 10 months ago 44
Android Question

Set Spinner to Unselected

I currently have a whole bunch of spinners in my application. I wasn't thinking much and for each spinner, the first index is filled with

. It's not a big deal, but I was hoping to make it a bit cleaner.

I was wondering if there was a way that instead of calling
setSelection( index )
, I wanted to know if there was a way to set a Spinner to have nothing selected.

Basically, I want the spinner to have a list of items within it, but display none of them until you click on it. I also don't want there to be a blank index at the top.

I think its quite possible that there is no way to do this, so if anyone is sure of this, please let me know.


Answer Source

spinners have to have a selected state. i would recommend having a "no selection" option

Another option is to have the bottom button selected and then set that one to be invisible (the reason i set the last one to selected is so that you dont have a chunk of blank space in your app as that looks a bit trashy):


// do this for all your other ones if you want


maybe not the most efficient but it works so i hope that helps (still new so cut me some slack)!