Can a GridView have a footer and header just like ListView?

Posted blfbuaa

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Can a GridView have a footer and header just like ListView?相关的知识,希望对你有一定的参考价值。

Aquick question:

In ListView I use this code:

list.addHeaderView(headerView);

How to deal with it when working on gridview?

Thanks.


There is a quite good implementation of GridView with header support in Google Photos application, as it‘s OSS code you can use it as is or take it as a reference for your own implementation:http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/4.3_r2.1/com/android/photos/views/HeaderGridView.java

Basic idea is quite simple - WrapperAdapter creates an fake row by increasing number of items by number of columns and then return a header view for the item.


original text:http://stackoverflow.com/questions/5790215/can-a-gridview-have-a-footer-and-header-just-like-listview

answered Jan


以上是关于Can a GridView have a footer and header just like ListView?的主要内容,如果未能解决你的问题,请参考以下文章