3级扩展列表视图刷卡功能 [英] 3 level expandable list view with swipe feature

查看:139
本文介绍了3级扩展列表视图刷卡功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建3级可扩展的列表,在第三级刷卡功能。

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

我面临的刷卡功能,在第三级swipelistview,当高速缓存使用的问题。

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

有关刷卡,我使用47deg / Android的swipelistview https://github.com/ 47deg / Android的swipelistview / 库。 为了创建3级扩展列表,我用code从 HTTP ://mylifewithandroid.blogspot.in/2011/02/3-level-expandable-lists.html 。 我曾经在3个地方缓存的概念:1,第2级扩展列表,2 3级swipelistview 3. swipelistview节点。通过这种方式,它给了不错的性能,同时滚动/扩展/折叠扩展列表。

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.

但在那个时候,刷卡功能停止工作。如果我停止使用缓存的swipelistview节点级(内部getview()swipelistview的适配器的功能),刷卡功能正常工作。

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.

我的问题是,如果我创建swipelistview类新的观点,每次在getview()或重用convertedview,刷卡功能继续工作。但是,如果我创建节点第一次只为每一个孩子,下次就getview要求,我给已经prepared节点,为什么刷卡功能停止工作。

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。当我说,刷卡功能停止工作,GUI被不正确地更新。

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

我有示例项目可与我,如果有人需要它。或者,如果有人需要的code特定部分,我还可以提供相同的

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.

推荐答案

为了得到它的工作,我用下面的方法来实现它。我不知道,这是最好的方法还是不行。

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

  • 我们用 getViewTypeCount() getItemViewType()在列表视图基础转接功能,返回不同的看法键入的每一行。通过这种方式,它并没有试图用同样的观点,而使用 getView()设施。

  • 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.

同样,对于 ExpandableListViewAdapter ,我们使用了 getChildTypeCount() getChildType( )返回不同的类型。

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

这样的话,我能达到我所期待的。 我相信,这是不是最优化的方式,因为它不允许,组件reusablity,但它在我的情况,因为我的应用程序并不需要成千上万的组件的列表中。

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.

这篇关于3级扩展列表视图刷卡功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆