Android: image with scrolled overlay

Android: image with scrolled overlay

I got inspired with new look of Google Play Market and decided to change the way “Is it kosher?” app shows detailed information with picture.
So, I got an idea to show image with overlay, which will be scrolled down and the picture will be shown in full.

Here is the result of my work:

Solution appeared to be not the simplest one – spend several days on research.
Layout looks as following:

Java code contains the following lines:

Some explanations:
– innerView gets padding dynamically. This is done to make sure that there is enough space for showing the picture in fill.
– viewHeight calculations are done in OnGlobalLayoutListener due to the reason, that whole View should be loaded first to obtain the real dimensions.
– I wanted to make overlay to be seen on the moment of page open, but not scrolled fully till the bottom. For that purpose we start new Thread with scrolling in OnGlobalLayoutListener. I haven’t found other way to solve this task and seems to be it is the best one. I want to have a small step-down, that is why there is such solution.