ListViewr带有选择框的实现

lv_show = (ListView) findViewById(R.id.lv_show);
        lv_show.setVerticalScrollBarEnabled(false);
        //带有选择的样式
        //lv_show.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_checked, data));
        //带有选择框的样式
//        lv_show.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_multiple_choice, data));
//        lv_show.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
        //单选样式
        lv_show.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_activated_2, data));
        lv_show.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

单选样式的listview的选择模式要发生改变

原文地址:https://www.cnblogs.com/84126858jmz/p/4884430.html