Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a scrollable header to a gridview in android?

Im attempting to add a scrollable header to a gridview layout in android, Ive tried about everything I could find on the web but I cant get it to work, this type of layout appears in a number of popular apps such as facebook and instagram but Im not able to find any such sample code that would give me an Idea as to how to actually do it, anyone know how this can be achieved? adding the gridview to a scrollview doesnt work either, below are some photos that illustrate what Im trying to achieve.

This is before the scroll:

before scroll

This is after the scroll: after scroll

like image 317
Edmund Rojas Avatar asked Oct 20 '12 21:10

Edmund Rojas


1 Answers

Do not use a gridview. Instead use a listview which has this header functionality. And in the getView() method of your adapter you will have to return a list item divided into the number of columns you want.

like image 74
Emil Sjölander Avatar answered Sep 28 '22 13:09

Emil Sjölander