Android: setSelection having no effect on Spinner

前端 未结 11 1312
我在风中等你
我在风中等你 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:50

    You might try

    mSpinner.post(new Runnable() {        
        public void run() {
          mSpinner.setSelection(1);
        }
      });
    

    this will post the runnable action to run as soon as the view is created

提交回复
热议问题