質問

sorry if there is another question like this but i couldn't find my answer.

I want to know the way to programmatically set a checkbox to state where it is already selected when I populate the ListView. The checkbox is in the Listview and i am using android.R.layout.simple_list_item_multiple_choice.

Any help would be nice, thank you.

役に立ちましたか?

解決

There is a method on ListView that you can call to set an item 'checked' state:

for (int i = 0; i < getListAdapter().getCount(); i++) {
    getListView().setItemChecked(i, true);
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top