OnItemCLickListener not working in listview

I just found a solution from here, but by deep clicking.

If any row item of list contains focusable or clickable view then OnItemClickListener won’t work.

The row item must have a param like
android:descendantFocusability = "blocksDescendants".

Here you can see an example of how your list item should look like.
Your list item xml should be…
row_item.xml (your_xml_file.xml)

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:baselineAligned="false"
    android:descendantFocusability="blocksDescendants"
    android:gravity="center_vertical" >

    // your other widgets here

</LinearLayout>

Leave a Comment