Open iielse opened 7 years ago
compile ('com.alibaba.android:vlayout:1.0.10@aar') {
transitive = true
}
'com.android.support:recyclerview-v7:25.3.1'
recyclerView 设置代码
val virtualLayoutManager = VirtualLayoutManager(context)
val delegateAdapter = DelegateAdapter(virtualLayoutManager)
var vRecycler: RecyclerView
lateinit var concernAdapter: ConcernAdapter
lateinit var loadMoreAdapter: LoadMoreAdapter
...
vRecycler.apply {
itemAnimator = FadeInAnimator()
layoutManager = virtualLayoutManager
adapter = delegateAdapter
concernAdapter = ConcernAdapter().apply {
onItemRemovedListener = object : ConcernAdapter.OnItemRemovedListener {
override fun onItemRemoved(view: View, oi: OrangeInfo, position: Int) {
notifyTotalCountChanged(--totalCount)
}
}
}
delegateAdapter.addAdapter(concernAdapter)
loadMoreAdapter = LoadMoreAdapter()
delegateAdapter.addAdapter(loadMoreAdapter)
delegateAdapter.notifyDataSetChanged()
}
https://github.com/iielse/vlayoutTest1
这里有个简单的demo
, 点击删除 value b
后,再删除 value c
value d
就会出现
不过我后来把那个 ConcernAdapter
中的 SingleLayoutHelper
改成 LinearLayoutHelper
似乎就好啦
ok, 我测一下看看。
不过我后来把那个
ConcernAdapter
中的SingleLayoutHelper
改成LinearLayoutHelper
似乎就好啦
你好,请问你这个报错最终是怎么解决的?谢谢
不使用SingleLayoutHelper
;
adapter
只设置一次;
不使用
SingleLayoutHelper
;adapter
只设置一次;
也就是说你代码里面SingleLayoutHelper全部用LinearLayoutHelper 代替,adapter
只设置一次这个说法可以具体一点么?或者贴一下你的代码,谢谢
当一个 DelegateAdapter.Adapter 实例内的元素数量刚好为2时,删除其中任何一个都会引发这个崩溃
Adapter
代码崩溃触发代码