开发者

How to work with Multiple listviews and ViewFlipper (android)

开发者 https://www.devze.com 2023-02-28 08:20 出处:网络
In my application I have an activity which contains a viewflipper with 3 listviews inside. I have implemented the segmentedbut开发者_如何学Cton widget to change between the listviews inside the viewfl

In my application I have an activity which contains a viewflipper with 3 listviews inside. I have implemented the segmentedbut开发者_如何学Cton widget to change between the listviews inside the viewflipper. Doing this way, I keep three listviews loaded in memory and display them according to the button selected.

Does android allow the developer to change the list adapter in runtime? I was thiking about removing the viewflipper and keep only one listview and when the user select one button, i only change the adapter from the listview.

Is this feseable? Wouldnt it be consuming more memory and cpu instead of having the three listviews inside the viewflipper?

Any answer that can help me is very appreciated.

Many thanks T


You can certainly change the list adapter on a list at runtime, and this sounds like a much better alternative if what you are trying to accomplish is truly just changing the contents of the list.


To add to Micah's answer, you can also have 2 ListViews in your ViewFlipper in order to create a sliding effect when moving between the two lists.

0

精彩评论

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

关注公众号