Is it possible to have a spinner and a list view on the same page?

前端 未结 2 548
醉酒成梦
醉酒成梦 2021-01-25 10:18

I want to have a spinner at the top of page, and then generate a list view below the spinner according to what the user has selected from the spinner, does anyone know a good tu

2条回答
  •  清歌不尽
    2021-01-25 10:35

    Yes it is possible. Create a layout containing spinner and listview. In the listactivtiy, use setContentView to create a view based on the layout. Get a handle on the spinner (findViewById) and do whatever you need to do with it. Based on the spinner selection - set the array or cursor for your listview adapter. That should be enough.

提交回复
热议问题