Android spinner set default text

后端 未结 3 703
迷失自我
迷失自我 2021-01-12 05:15

I\'ve implemented a spinner into my app. I\'m showing a list of schools but I want a default value/prompt so the user knows to select a school. I also want to do this withou

3条回答
  •  旧时难觅i
    2021-01-12 06:03

    Try setSelection method to set default text:

    spinner.setSelection(adapter.getPosition(DEFAULT_CURRENCY_TYPE))

    And look this link: How to make an Android Spinner with initial text "Select One". It is very useful (@aaronvargas answer is what you need).

提交回复
热议问题