android listview+button button点击事件失效 .在线等,马上结贴!

qq737604771 2014-08-28 05:37:59
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>

<LinearLayout
android:id="@+id/ll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:padding="20dp">

<Button
android:id="@+id/new_bus_info_line_map_id"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/new_nearby_map"
android:textColor="#000000" />

</LinearLayout>

<ListView
android:id="@+id/bus_info_list_show"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:divider="@drawable/new_hr_bg"
android:scrollingCache="false" />
</RelativeLayout>
...全文
599 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
孙晓宇 2016-06-29
  • 打赏
  • 举报
回复
把Button换成TextView
jklwan 2016-06-29
  • 打赏
  • 举报
回复
用textview代替button
qq_29977267 2015-07-20
  • 打赏
  • 举报
回复
最外层的布局换成LinearLayout就行了
heaven_wsh 2014-11-21
  • 打赏
  • 举报
回复
这个很普通的一个layout,你Relativelayout,但是没有设置相对位置,可能View形成了覆盖,你设置一下相对位置应该就ok了
青梅大叔 2014-11-21
  • 打赏
  • 举报
回复
初始化listview的时候让listview的focus = false
bdmh 2014-08-29
  • 打赏
  • 举报
回复
在listview的adapter的getview中绑定button的click
tt134679 2014-08-29
  • 打赏
  • 举报
回复
我也遇见过这个情况,不过我是LISTVIEW的点击事件失效了,你把button换成imageButton试下,在imageButton布局文件加上楼上的那段代码不然iamgeButton获取焦点那么listview点击会失效。要是换了还不行应该是你适配器的问题吧。。。
天自在 2014-08-28
  • 打赏
  • 举报
回复
在布局中加android:descendantFocusability="blocksDescendants"

80,360

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧