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. setPrompt("Title");
Android Spinner is just a drop down list similar to what's seen in other programming languages such as in HTML pages. In Android, Spinner is used to select one value from a set of values. In the default state, a spinner shows its currently selected value.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With