的TextView和Button每一行和onListItemClick在() [英] TextView and Button in each row and onListItemClick()

查看:72
本文介绍了的TextView和Button每一行和onListItemClick在()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有它的一些元素的ListView。每一行都有一个TextView和一个按钮。它看起来是这样的:

I have a ListView with some elements on it. Each row has a TextView and a Button. It looks like this:

|在一排中的某些文本(按钮)|

现在,当我点击这个文本没有任何反应。根本没有一个函数被调用。但是,当我按一下按钮,我可以处理该事件。我用onListItemClick()

Now, when I click on this text nothing happens. Simply no one function is called. But when I click on the button I can handle the event. I use onListItemClick()

所以,我应该用什么来代替这个TextView中要能够处理一个事件(当我点击的文字)?

So what should I use instead of this TextView to be able to handle an event (when I click on the text)?

在此我不得不每行只有一个TextView中,当我点击一排细小的一切工作(onListItemClick()被调用)。

Before this I had only one TextView in each row and when I was clicking on a row everything worked fine (onListItemClick() was called).

感谢你在前进!

推荐答案

添加属性可聚焦=假的TextView ::

<TextView
...
...
        android:focusable="false"
        />

和可能,你需要做同样的你的ListView里面的其他元素。

and probably you will need to do the same to the other elements inside your ListView.

这篇关于的TextView和Button每一行和onListItemClick在()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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