1、我希望在ListView的子条目中获部分组件的点击事件。

这是一个仿微信的项目,我希望当且仅当点击左边按钮、头像、文本框的情况下触发onitemclick方法。错误效果 如下。

bVtmfN

2、ListView的XML代码

android:layout_height="match_parent" android:layout_below="@id/et_search_id"

android:descendantFocusability="blocksDescendants"/>

子条目的XML代码

android:layout_width="match_parent" android:layout_height="match_parent">

android:layout_margin="6dp" android:clickable="false"

android:layout_height="wrap_content" android:textSize="@dimen/text_size_xs"/>

android:layout_height="60dp" android:gravity="center_vertical"

android:paddingStart="100dp" android:layout_below="@id/first_name_id"

android:paddingEnd="0dp" android:background="@drawable/d_bg_item"/>

android:layout_width="50dp" android:layout_alignTop="@id/name_id"

android:layout_height="50dp" android:layout_alignBottom="@id/name_id"

android:contentDescription="@string/load_fail"

android:src="@drawable/head_nor" android:layout_marginTop="5dp"

android:layout_marginStart="40dp" android:layout_marginBottom="5dp"/>

android:layout_height="30dp" android:layout_margin="6dp"

android:layout_alignTop="@id/name_id" android:layout_alignBottom="@id/name_id"

android:clickable="false" android:focusable="false"

android:focusableInTouchMode="false" android:button="@drawable/d_bg_but_jy"/>

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐