OnItemClickListener Not Triggered on Android GridView

后端 未结 6 1904
情歌与酒
情歌与酒 2020-12-03 00:50

I have a Gridview filled by an Adapter which returns LinearLayouts each contains an ImageButton and TextView.

In the adapter I am binding an onClick and onLongClick

6条回答
  •  一生所求
    2020-12-03 01:35

    Do not use clickable objects in the grid. In that case Android cannot handle the click event of GridView.

    Instead, use something to show a similar user interface view. Then handle that object's click actions.

    Don't: put Button in the GridView to perform some click actions.

    Do: put an ImageView instead of ImageButton and handle ImageView's click events.

提交回复
热议问题