您的位置:首页 > 其它

解决ListView中有Button类而失去点击事件的问题

2015-03-11 11:34 363 查看
在你的xml布局文件中添加如下红色字段:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:background="@null"

android:orientation="vertical"

android:descendantFocusability="blocksDescendants" >

<Button

android:id="@+id/btn_service_item"

android:layout_width="match_parent"

android:layout_height="50dp"

android:background="@drawable/btn_cancel"

android:gravity="center"

android:textColor="@color/blue_service"

android:layout_marginBottom="1px"

android:focusable="false"

android:clickable="false" />

</LinearLayout>

这样,你点击ListView中的item就会优先于Button获得点击事件了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐