简体   繁体   English

复选框在简单列表视图中不可单击

[英]Checkbox not clickable in simple listview

I have simple listview (Not custom listview) with checkbox in right side but these checkboxes are not clickable. 我的右侧具有简单的列表视图(非自定义列表视图),但这些复选框不可单击。

Here is my MainActivity.java Code: 这是我的MainActivity.java代码:

setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_multiple_choice, getResources().getStringArray(R.array.myarray)));

and here is xml code: 这是xml代码:

 <ListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
         >
    </ListView>

Also I need help to find out which checkbox was clicked on click of some button. 我也需要帮助来找出单击某个按钮后单击了哪个复选框。

I have seen may questions posted on stackoverflow but they were all realeated to custom listview. 我已经看到了可能在stackoverflow上发布的问题,但是它们都实现了自定义listview。

listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
listView.setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_checked, getResources().getStringArray(R.array.myarray)));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM