Android ListView嵌套Button,Button事件覆盖item事件解决措施
发布时间:2021-11-21 20:27:24 所属栏目:教程 来源:互联网
导读:Android ListView嵌套Button,Button事件覆盖item事件解决办法 方法就是修改item布局的xml文件: 在根布局里加上: android:descendantFocusability=blocksDescendants 然后在按钮布局里加上: android:focusable=false item和按钮都 可以点了,就OK了 下面是
Android ListView嵌套Button,Button事件覆盖item事件解决办法 方法就是修改item布局的xml文件: 在根布局里加上: android:descendantFocusability="blocksDescendants" 然后在按钮布局里加上: android:focusable="false" item和按钮都 可以点了,就OK了 下面是布局示例: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:descendantFocusability="blocksDescendants" <Button android:id="@+id/worklog_update" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="修改" android:focusable="false" /> <Button android:id="@+id/worklog_del" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="删除" android:focusable="false" /> (编辑:东莞站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |