开发者

ViewSwitcher reset spinner selected position

开发者 https://www.devze.com 2023-01-25 17:15 出处:网络
I have an Activity that use a ViewSwitcher. the view switches between a list view(child #1) and another view that contains 2 spinners(child #2)

I have an Activity that use a ViewSwitcher. the view switches between a list view(child #1) and another view that contains 2 spinners(child #2)

In activity onCreate using spinner.setSelection i set a specific position for sp开发者_如何学编程inner. Later if next view is requested i execute viewSwitcher.showNext and spinner selection is empty - it seems like the showNext resets the spinner position. i have tried to save the position and set again after showNext is called but dont works.

Any ideas?


I have the same problem, I get a Solutions but I think it's very stupid.

you can use this.

1.set the different layout in switcher with different id. 2.repeat the adapter ,

adapter = new SimpleCursorAdapter(this, R.layout.list, cursor, new String[] { Structer.TITLE ,Structer.STATUS,Structer.TITLE ,Structer.STATUS}, new int[] { R.id.detail ,R.id.detailStatus,R.id.detail2,R.id.detailStatus2});

then ,you can get it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号