how to add a checkbox in a listview?

后端 未结 5 1143
长发绾君心
长发绾君心 2021-01-06 15:34

i have a question, been stuck for a while, i dont know how can i add a checkbox in the list, for example if I have a list of items i want to be able to check them. my xml c

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-06 16:18

    final ListView lView = (ListView) findViewById(R.id.ListView01);
    lView.setAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_multiple_choice, items));
    lView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    

    Here item is an array.

提交回复
热议问题