setOnItemClickListener() not working on custom ListView @ Android

前端 未结 6 1809
刺人心
刺人心 2020-12-01 09:55

I have Implemented a custom ListView by extending LinearLayout for every row. Every row has a small thumbnail, a text and a check box.

6条回答
  •  既然无缘
    2020-12-01 10:09

    old answer: I wrote in previous post here

    android:focusable="false"
    android:clickable="false"
    

    will not help when ImageButton is in custom view.. One must use button.setFocusable(false); during runtime (from java source code)

    Edit: There is even more elegant solution. Try to add android:descendantFocusability="blocksDescendants" in root layout of list element. That will make clicks onListItem possible and separately u can handle Button or ImageButton clicks

提交回复
热议问题