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


原文地址:https://www.cnblogs.com/blfbuaa/p/7242127.html