Android ListView标题禁用单击 [英] Android ListView Header Disable Click

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

问题描述

我在我的ListView的BaseAdapter中使用 isEnabled ,控制哪些行可以点击。但是,我想禁用我的标题的点击事件,isEnabled不工作。位置0指向第一行,因此我无法控制标题点击。

I'm using isEnabled in my BaseAdapter of ListView and controlling which rows can be clickable. However, I want to disable click event for my header and isEnabled does not work. Position 0 points the first row, therefore I can not control header click.

另一方面,当我使用 addHeaderView 提供参数(header,null,false) ,它工作,但分隔线以这种方式失踪。

On the other hand, when I add header using addHeaderView giving arguments (header, null, false) , it works but dividers are missing in that way. How can I manage this?

推荐答案

有没有人知道这个问题? >

您可以使用 addHeaderView(header,null,false)。对于标题,请使用下面的分隔符填充具有标题内容的视图。此视图是我用于分隔符。

You can use addHeaderView(header, null, false). For the header, inflate a view which has your header content with a divider underneath. This view is what I used for the divider.

<View
    android:layout_width="fill_parent"
    android:layout_height="1px"
    android:background="#adaaad" />

这篇关于Android ListView标题禁用单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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