问题描述
我的ListView用我自己的布局和CustomCursorAdapter。每一行都有它自己的复选框。所以......这是绝对清楚地表明sroll在复选框松散的状态。我发现的唯一的东西是Android保存复选框状态ListView中使用游标适配器但没有答案了。还有一个问题。我有同样的问题与我CustorArrayAdapter。我用SparseBooleanArray保持复选框国解决了这个问题。它工作正常,但每滚动呼吁onCheckedChanged。这是正常的吗?这笔交易是我的列表视图描述报警内容,并定期调用(的onCheckedChanged)启动/停止报警。很多unnesseccary行动。
I have ListView with my own layout and CustomCursorAdapter. Every row has it's own checkbox. So... it's absolutely clear that during sroll the checkboxes loose their states. The only stuff I found is Android save Checkbox State in ListView with Cursor Adapter but there is no answer there.And one more question. I had the same problem with my CustorArrayAdapter. I solved that problem using SparseBooleanArray to keep checkboxes states. It works fine, but every scroll calls onCheckedChanged. That's normal? The deal is my list view describes alarm elements and periodic calls (of onCheckedChanged) start/stop the alarms. A lot of unnesseccary actions.
推荐答案
有与其中具有可检查的项目时在ListView一些担忧。我建议以下链接:
There are a few concerns with the ListView when having checkable items in it. I would suggest the following link:
http://tokudu.com/2010/android-checkable-linear-layout /
我认为这是接近你想要什么。
I think it's close to what you want.
这篇关于安卓的CursorAdapter,ListView和复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!