3 level expandable list view with swipe feature

别来无恙 提交于 2019-12-20 06:18:10

问题


I am creating 3 level expandable list with swipe functionality at 3rd level.

I am facing an issue with swiping feature at 3rd level swipelistview, when caching is used.

For swiping, I am using "47deg/android-swipelistview" https://github.com/47deg/android-swipelistview/ library. For creating 3 level expandable list, I used code from http://mylifewithandroid.blogspot.in/2011/02/3-level-expandable-lists.html. I used cache concept at 3 places: 1. 2nd level expandable list, 2. 3rd level swipelistview 3. swipelistview nodes. This way, it gave good performance while scrolling/expanding/collapsing the expandable list.

But at that time, swiping functionality stop working. If I stop using cache at swipelistview node level (inside getview() function of adapter of swipelistview), swiping feature works properly.

My question is, if I create new view everytime at getview() of swipelistview class or reuse convertedview, swiping feature continues to work. But if I create node first time only for every child and next time on the getview request, I sent already prepared node, why swiping feature stops working.

P.S. When I say, swiping feature stops working, GUI is not updated properly.

I have sample project available with me, in case anyone needs it. or if anyone requires specific portion of the code, I can also provide the same.


回答1:


I think your problem is like these questions and there is solution so Check these Link and link2




回答2:


In order to get it working, I implemented it with following approach. I am not sure, this is the best way or not.

  • We used getViewTypeCount() and getItemViewType() functions in listview base adapter to return different view type for each row. This way, it does not try to use same view while using in getView() facility.

  • Similarly for ExpandableListViewAdapter, we used getChildTypeCount() and getChildType() to return different type.

This way, I was able to achieve what I was looking for. I am sure, this is not the most optimize way as it does not allow, reusablity of components, but it works in my case, as my app does not need thousands of components in list.



来源:https://stackoverflow.com/questions/18857452/3-level-expandable-list-view-with-swipe-feature

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!