OnItemClickListener Not Triggered on Android GridView

后端 未结 6 1920
情歌与酒
情歌与酒 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:51

    If you wants to use Button or ImageButton then you need to write these attributes in your xml code of the widgets.

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

    Its works for me.

    But in GridView, Try to avoid use of these widgets. You can use any other widgets in place of these (Like ImageView or any other).

提交回复
热议问题