listview中添加了单选框(或其他控件),此时listview将不能点击,原因是此时单选框获取焦点事件的优先级要高于listview的焦点事件,使得listview变得不可点击。
解决方法:
1、在xml文件中设置相关属性:如
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:orientation="horizontal" >
<ImageView
android:id="@+id/imageView"
android:layout_width="100px"
android:layout_height="wrap_content"
android:focusable="false" />
<Button
android:id="@+id/button"
android:layout_width="200px"
android:layout_height="100px"
android:focusable="false"
android:text="@string/hello" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello" />
</LinearLayout>