Search code examples
androidandroid-layoutandroid-listviewscrollandroid-scrollview

Android - Snap layout to top after scrolling down vertically (similar to happycog.com's top menu)


In Android, is it possible to snap a layout (RelativeLayout / LinearLayout / etc.) to the top after scrolling down vertically (similar to happycog.com's top menu)?

Can this be achieved in both xml and java?


Solution

  • As per earlier comment:

    Yes, this is possible and is commonly referred to by the layout being sticky. There are implementations available for both ListView and ScrollView, from the same author (Emil Sjölander). Both libraries come with sample code too.