开发者

setting initial text on spinner [duplicate]

This question already has answers here: How to make an Android Spinner with initial text "Select One"? (36 answers) Closed 9 years ago.

In Android, I want to use 开发者_C百科a Spinner that initially (when the user has not made a selection yet) displays the text "Select". 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 selection, the selected item is displayed in the Spinner instead of "Select".


Put "Select" at 0 position in your list or array which you are using to create Spinner.


Add "Select" at 0th potion of array of spinner item


Prior to being touched, spinners always display the first item in their array of options. Create the spinner with the text "Select" as its only option, which will cause it to be shown. Then override the onClick() method to reload the spinner's content to the list of options you want to show the user.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜