ListView setOnItemClickListener not working in custom list view

前端 未结 3 844
感动是毒
感动是毒 2021-01-05 14:15

I have a list view with two text view and one edit text in each row , list view setOnItemClickListener() is not working.

Here My Java Code.

3条回答
  •  梦谈多话
    2021-01-05 14:37

    In my opinion, because there is Button or ImageButton in your custom list item layout.

    So there is two solution,

    1. Replace the button to other elements, and remove onClick listener in the Adapter code. This is the easy way to solve this.

    2. Disable the button focus, like this,

    android:focusable="false"
    android:focusableInTouchMode="false"
    

    Please refer this ListView setOnItemClickListener not working by adding button

    Have fun. @.@

提交回复
热议问题