Maybe you want to call addHeaderView()
or addFooterView()
in GridView
, which it does not have.
It's nature that we want to add header view or a footer view to a GridView
. Maybe your have been searching a long time like me, but finally find no solution.
Here, I will give out an solution.
I post this answer just want people who come here can get what the want.
Let's have a look the screen snapshot.

the usage is very simple
GridViewWithHeaderAndFooter gridView = (GridViewWithHeaderAndFooter) v.findViewById(R.id.ly_image_list_grid);
LayoutInflater layoutInflater = LayoutInflater.from(this);
View headerView = layoutInflater.inflate(R.layout.test_header_view, null);
View footerView = layoutInflater.inflate(R.layout.test_footer_view, null);
gridView.addHeaderView(headerView);
gridView.addFooterView(footerView);
It'a single file project, now it hosts at GitHub: https://github.com/liaohuqiu/android-GridViewWithHeaderAndFooter
You can follow the link above to access the code. Happy coding.
Actually you can create layout with two columns and use ListView. In getView you should manipulate with columns and set there some data.
Also you can create just one column in first and last row. It will look like header or footer.
Besides, you can look through these links:
来源:https://stackoverflow.com/questions/26726538/android-gridview-add-header-and-footer-like-listview