How to know which view inside a specific ListView item that was clicked

后端 未结 5 1288
逝去的感伤
逝去的感伤 2020-12-28 18:52

I\'m having a ListView with my own custom adapter derived from a BaseAdapter. Each item in the ListView has sub items such as Im

5条回答
  •  情深已故
    2020-12-28 19:42

    Since you have only an ImageView and a TextView, you can change your ImageView to ImageButton. You can then add a listener on the ImageButton that will be called if the user clicks on the image. If he clicks anywhere else within the item (including the TextView), the onItemclicklistener will be called. This is much simpler i think.

提交回复
热议问题