view from back does not respond to click android

邮差的信 提交于 2019-12-04 17:01:59

add this to root layout of ImageButton

android:descendantFocusability="blocksDescendants"

try with:

    android:layout_width="wrap_content"

    android:layout_height="wrap_content"

inside imagebutton

That because your "info Button" has gained focus form your gridview item, you can only click on the button, in this case is 'info Button'. However, you could also click on your gridview item by set the "info Button" NOT focusable. Try this:

<Button
        android:id="@+id/your_info_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="info Button"
        android:focusable="false"
        android:focusableInTouchMode="false" />

Hope this helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!