Home » Android » How to add Title in Spinner in android

How to add Title in Spinner in android

Posted by: admin June 15, 2020 Leave a comment


I have a problem I have design a spinner and add items(i.e. states) on it.
Now I want to show “SELECT STATES” on main Screen only once. When we click on that spinner
it will hide this text(“SELECT STATES”) and should show the list of the states.

Thanks in Advance.

How to&Answers:

Easy: spinner.setPrompt(“Title”);
or xml: android:prompt=”@string/title”


Here is my favourite solution to the problem – How to make an Android Spinner with initial text “Select One”

I’m sorry it is very long, so I’m not keen to repost it here again – please check it out on the link.

The nice part is that I was able to use his code without any changes at all.


I don’t think it has such attribute, even google uses a textview to show the title in the example:

If you really want to do it that way, you can add the String “SELECT STATES” in the first slot of the list, and then remove it after the first item selection.