按一下按钮和ListView点击 [英] Button click and ListView click

查看:213
本文介绍了按一下按钮和ListView点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个的ListView 。一个列表项的点击我开始活动。现在,我已经添加了一个按钮,我想开始一个又一个活动的按钮的ListView 和的onclick。添加一个按钮后,我可以点击按钮,开始活动,但现在我无法点击列表项。发生了什么事ListView的项目点击??

I have a ListView. on click of a list item I start a Activity. Now I have added a Button on that ListView and onclick of a button I want to start a another activity. After adding a Button, I can click on the button and start a Activity but now I can not click a list item. What happened to listview's item click ??

推荐答案

阅读这篇优秀的博客帖子:的焦点与列表行和ImageButtons问题

Read this excellent blog post: Focus problems with list rows and ImageButtons

从本质上讲,你应该添加以下的行项目的XML根布局元素。

Essentially you should add the following to your root layout element in the row-item xml.

的android:descendantFocusability =blocksDescendants

这篇关于按一下按钮和ListView点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆