我有一个包含复选框的列表项,我想能够单击复选框和列表项本身。不幸的是,似乎存在某种冲突,因为当我注释掉复选框时,我只能单击该项。我记得有一种方法可以解决这个问题,但是我现在找不到了。谢谢。
编辑:这是使用ListFragment的情况,所以无需调用setOnItemClickListener。
好的,这是列表项的XML。问题出在复选框上,但我觉得最好把所有内容都复制一遍。
编辑:这是使用ListFragment的情况,所以无需调用setOnItemClickListener。
好的,这是列表项的XML。问题出在复选框上,但我觉得最好把所有内容都复制一遍。
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list_item_survey"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/SimpleListItem">
<TextView
android:id="@+id/survey_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/ListItemTitle" />
<TextView
android:id="@+id/survey_date"
android:layout_below="@id/survey_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/ListItemSubtitle" />
<TextView
android:id="@+id/survey_completed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/survey_title"
android:textColor="@color/accent_1"
android:text="@string/survey_completed"
style="@style/ListItemSubtitle" />
<CheckBox
android:id="@+id/survey_did_not_attend"
android:layout_below="@id/survey_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/survey_did_not_attend"
android:focusable="false"
style="@style/ListItemSubtitle" />
</RelativeLayout>