开发者

Checkbox selection with listview [duplicate]

This question already exists: Closed 11 years ago.

Possible Duplicate:

android : check box select开发者_开发技巧ion problem

I'm trying to select all my checkboxes in the layout, when I'm pressing 'check all' button. I've done a list and placing a checkbox with that list.

Now, I want to select all my checkboxes in the layout using button click. How can I proceed to this?

(Important : I'm placing only one checkbox and this will show with every item in list using listview).


Three are two possibilities. If you are using default style means listview.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); then there is one solution.

If you are using custom adapter means in the layout you maintain two images one for normal and one for checked then there is other solution.

If you follow first way then this is the solution()...

http://www.ziddu.com/download/16103715/LvCheckBoxes.zip.html

If you are followed second way then let me know. I will give that example...


Assuming you are using custom list adapter: maintain a boolean flag and on button press make it true and call yourAdapter.notifyDataSetChanged() from there and in your adapter using this bool value set the checked or unchecked state of checkbox..

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜