Android ListView Header Disable Click [duplicate]

人走茶凉 提交于 2019-12-20 11:06:31

问题


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.

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?

Is there anyone who knows this problem?


回答1:


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" />


来源:https://stackoverflow.com/questions/8670102/android-listview-header-disable-click

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!