I have a ListView
with a custom list item layout and a selection state for that layout, also i have a checkbox
inside a item layout, the problem is,the checkbox is avoiding list item be selected
when is presented in layout, but when i change the visibility to gone
of checkbox
the layout for item respond to selectors
.
selector_list.xml
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CustomTextView
android:id="@id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_8"
android:textColor="@color/gray_light_d2"
android:textSize="@dimen/sp_12"
custom:typeface="robotoBold" />
<CheckBox
android:id="@android:id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" />
</RelativeLayout>
Add the below attributes to the check box
android:focusable="false"
android:focusableInTouchMode="false"
or add the below to the relative layout an try.
android:descendantFocusability="blocksDescendants"
This happens because the checkbox takes focus when you click on the list item. So try the above suggestions