在listview中的item中按钮的点击事件冲突解决方案

在使用自定义的listview界面中有按钮实现点击时,listview的点击事件就会被覆盖

如图 需要实现每个item点击 评论和listview的点击进入
这里只需要在listview的子item中设置如下

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:descendantFocusability="blocksDescendants"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
<ImageButton
    android:id="@+id/img_but"
    android:focusable="false"
    android:clickable="true"
    android:layout_marginTop="4dp"
    android:layout_marginLeft="10dp"
    android:src="@mipmap/ic_toggle_star"
    android:layout_width="15dp"
    android:layout_height="15dp" />
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容