Search code examples
androidandroid-layoutandroid-listviewandroid-linearlayout

Is it possible to "pile up" headers in a sectioned listview or linearlayout when users scroll


I have an idea but I don't know if it can be realized on android.

Here is the idea:
I have a form with several sections for users to fill in. For now the form is in a LinearLayout which is enclosed in a ScrollView. The form has three sections: step1, step2, and step3. What I want to do is when the user scrolls down, the sections collapse and the headers remain on the top of the ScrollView. I created a couple illustration below to help describe what I want:

Before Scrolling:
screenshot http://img15.hostingpics.net/pics/421226951.png

After Scrolling:
screenshot
(source: hostingpics.net)

Thanks for your response!


Solution

  • There are some basic code snippets from google devs. Roman Nurik showed some sticky headers for a ListView. Check the second solution in the provided video, it is not exactly what you are looking for but it is close.

    You could also check the Synchronized Scrolling Library which provides a sample app in the market. You should check how he has implemented the last sample "similar to Gmail app" which looks like what you described.