开发者

Android: Remove data from list and add new list

开发者 https://www.devze.com 2023-01-23 12:35 出处:网络
I have lot of lists: for example: Categories, and subCategories, in my case some Categories has subcategories,

I have lot of lists: for example: Categories, and subCategories, in my case some Categories has subcategories,

So What I want to do, is if the categories has subcategories I want to clean the recently list and show the subcategories,

(This can be solved by creating new activity for only subcategories, but I would say that the most of the code woyld same)

I wounder how can I updoate list whit new data? If possible to add some animation when clicking, so the list goes to left when clicki开发者_如何学编程ng, and showing data comes from right,


I can think of two ways

  1. You can extend PreferenceActivity or ListActivity and dynamically change the list items (If they are static just use the preference activity, it will do animation for you)

  2. It is always possible to replace the current adapter of the list, but i have no idea on how to animate when you replace the adapter

listview.setAdapter(your_new_adapter);
listview.notifyDataDetChanged();

0

精彩评论

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