i want to build an listview and each row has a checkbox with image and textview, i almost made it, but when i put the checkbox i can’t press the list_row, i mean before i put the checkbox i can click the row and it hover as i did in my style, but after i put the checkbox when i click on the list_row it didn’t hover and the onitemclick doesn’t work, why ?
this is the xml of my each list_row
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/restaurant_list_item_selector"
android:orientation="horizontal"
android:padding="5dip" >
<!-- ListRow Left sied Thumbnail image -->
<LinearLayout
android:id="@+id/thumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip"
android:background="@drawable/restaurant_list_item_image_bg"
android:padding="3dip" >
<ImageView
android:id="@+id/restaurant_multi_select_list_item_image"
android:layout_width="50dip"
android:layout_height="50dip"
android:src="@drawable/rihanna" />
</LinearLayout>
<TextView
android:id="@+id/restaurant_multi_select_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/thumbnail"
android:layout_toRightOf="@+id/thumbnail"
android:textColor="#040404"
android:textSize="15dip"
android:textStyle="bold"
android:typeface="sans" />
<!-- Rightend check box -->
<CheckBox
android:id="@+id/restaurant_multi_select_checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:checked="false"
/>
</RelativeLayout>
Adding focusable elements (like CheckBox or Button) disables the ability to click the overall list item and their focusability has to be disabled.
Add the following in your checkbox attributes in the xml and then try
Hope this helps!!!