Android ListView禁用标题视图上的单击和上下文菜单?

问题描述:

我使用getListView().addHeaderView(view);设置了一个标题视图,在单击和上下文菜单方面,它目前与所有其他列表行的处理方式相同.如何使标头视图更像标头?或者,如何在ListView上方添加一些不属于ListView本身的内容?

I set a header view using getListView().addHeaderView(view); and it currently gets treated in the same way as all of the other list rows with regards to clicks and context menus. How can I make the header view act like more of a header? Alternatively, how can I just add some content above the ListView that is not part of the ListView itself?

查看

Look at the second and third parameter of the addHeaderView method. You can simply disable interaction with

getListView().addHeaderView(view, null, false);