Android: setSelection having no effect on Spinner

前端 未结 11 1304
我在风中等你
我在风中等你 2020-11-27 05:24

I\'m having some problem with setSelection on a Spinner. I set the value to be pre-selected when the spinner is shown in code, but it has no effect and the first alternative

11条回答
  •  长情又很酷
    2020-11-27 05:40

    I had similar problem. In my case setAdaper and setSelection were in correct order! Executed form onCreate worked, but when executed from onResume had no effect.

    The solution is to call setSelection(my_pos, true). Notice the second parameter.

提交回复
热议问题