我正在使用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.
更多推荐
发布评论