android spinner performClick onItemSelected

后端 未结 3 1449
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-19 09:22

I have a little problem with a spinner.

I create a Spinner the user click a Button. The Spinner is shown as it should be, but

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-19 09:25

    why do you have spinner = new Spinner(this) in the set-up ?

    surely you already have a Spinner in the XML of your layout, then you simply do spinner = (Spinner) findViewById(R.id.WHATEVER_THE_ID_IS_IN_THE_XML); so you don't need a new

    P.S. this is how I define a Spinner in an XML layout

    
    

提交回复
热议问题