Listview的行为不是完全可点击的(Behaviour of Listview not be totally clickable)

编程入门 行业动态 更新时间:2024-10-18 08:33:47
Listview的行为不是完全可点击的(Behaviour of Listview not be totally clickable)

我正在使用Listview包含一些视图,如imageview,textviews和按钮。 我在用

onItemClick(AdapterView<?> parent, View view, int position, long id)

处理列表项的点击均衡。 但是,虽然单击有效,但它不适用于所有行。 出于某些奇怪的原因,我无法单击项目28和29.如何才能使这些行也可以点击。 谢谢。

I am using Listview containing some views like imageview, textviews and buttons. I am using

onItemClick(AdapterView<?> parent, View view, int position, long id)

to handle the click evens of the list items. However though the click works, it doesn't work for all rows. For some weird reasons, I am not able to click item 28 and 29. How can I get these rows too to be clickable. Thanks.

最满意答案

通过在listview元素的父布局中添加这些行来解决

android:baselineAligned="false" android:descendantFocusability="blocksDescendants"

并在您使用的textview,imageview和按钮中添加这些行

android:clickable="false" android:focuseable="false" android:focuseableInTouchMode="false"

Thanks Guys for all the help. I didn't do much but I got to know the reason why some of the rows are not clickable. The row becomes unclickable whenever one of the other clickable views like imageView or buttons is assigned to a null value from my database. As far as there's a value or data to fill these views, the row is clickable.

更多推荐

本文发布于:2023-08-04 14:07:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1416004.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Behaviour   Listview   clickable   totally

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!