展会信息港展会大全

Android ListView嵌套Button,Button事件覆盖item事件解决办法
来源:互联网   发布日期:2015-11-26 15:36:07   浏览:3933次  

导读:方法就是修改item布局的xml文件:在根布局里加上:[html] <strong><span style="font-size:14px;color:#ff0000;">androi...

方法就是修改item布局的xml文件:

在根布局里加上:

[html]

<strong><span style="font-size:14px;color:#ff0000;">android:descendantFocusability="blocksDescendants"</span></strong>

然后在按钮布局里加上:

[html]

<span style="font-size:14px;color:#ff0000;"><strong> android:focusable="false"</strong></span>

item和按钮都 可以点了,就OK了

下面是布局示例:

[html]

<?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"

[html]

<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"

/>

赞助本站

人工智能实验室

相关热词: android开发 教程

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港