Fork us on GitHub

Sticky Headers

Letter headers that remain in place as you scroll
Post Image

Sticky Headers

Sticky headers was one of the first big requests we said no to. Back in the day a lot of people asked for it but we always shot it down because it was too hard to implement on top of our Swing inspired lists. This predated our Container improvement, InfiniteContainer and InfiniteScrollAdapter.

While our preference for lists has waned we never got around to show how easy it is to do sticky headers with Container until last week when Chen released the sticky headers demo.

It’s a pretty basic demo and relatively simple at that but that’s exactly the point. Codename One is flexible enough to do pretty much anything you want especially if you don’t lock yourself into a rather restrictive component like List.

Check out a live demo to the right here…​

You can see the full source for the demo here.

Chen chose to implement this on top of the glass pane which provides some capabilities and control over graphics, you could also use the layered pane or a LayeredLayout to achieve similar effects as well.

Share this Post:

Posted by Shai Almog

Shai is the co-founder of Codename One. He's been a professional programmer for over 25 years. During that time he has worked with dozens of companies including Sun Microsystems.
For more follow Shai on Twitter & github.