Pivot stick header with ViewPager with ListView

I want to implement a layout like this .

The catch is that the content must be a view pager (containing scrolling content).

My current plan is to implement this with one of the following

  • Make a basic inline layout view, with the top section holding the header taking up fixed space (viewer fills in whatever is left). Listen for touch events on inline layout to expand or shrink the title, once the title reaches its minimum size, propagate scroll events to the viewpager (how?).
  • Same as 1., but wrapped in a ScrollView
  • Same as 1. but listen for scrolling in the viewpager and propagate it by backing up the view hierarchy (like onScroll listeners).
  • Same as 3, but wrapped in a ScrollView

I have a better idea for how to implement 3/4, but it looks like it introduces a lot of combinations and "feels sad". I have less idea on how to do 1/2, but it feels (slightly) less rough. Anyway, using LinearLayout I would have to override onTouch and not onScroll. Not sure which one is preferable.

Ideally, I would like to find a more elegant solution (probably from Android L), but I also welcome the ideas / pros and cons of my proposed solutions.


source to share

All Articles