I have spinner
but in it only selectable items are shown as default title..
is there any way i can set title which doesn't appear when spinner unfolds...
I have spinner
but in it only selectable items are shown as default title..
is there any way i can set title which doesn't appear when spinner unfolds...
You will have to set the prompt attribute of spinner.
<Spinner android:id="@+id/discuss_about_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:prompt="@string/discuss_about_header"
android:layout_below="@+id/what_time_layout">
</Spinner>
Programmatically set title to Spinner
spinner.setPrompt("Title");
I don't know what the reason is, prompt don't support direct substitution of a string value. Instead you must have your string in strings.xml.
I just realized what you were trying to do. You want the Spinner "button" to have a title. Something like "- Select One -", correct?
If that is indeed the case, here is how I accomplished this. Don't use a spinner. Instead, use a button and style with the title to look like a spinner (will have to find how I did this). When the user clicks the button, open a "select one" dialog and style it to look like a spinner's dialog. I'll try to put a code sample up shortly.
I'm afraid this is not available out-of-the-box. You'll need to implement this yourself.