Q:

Android ScrollView how to keep component on screen when it scroll to top of the screen?

I have a ScrollView layout like this, for example:
<ScrollView> 
    <Component1>
    <Component2>
    <Component3>
    <Component4>
    ...
</ScrollView>

Inside ScrollView I have some components, each of them can be anything like LinearLayout, RelativeLayout, TableRow, ...
Now what I want is I will scroll the view, when the <Component2> reach the top of the screen, it will be keep on the screen and <Component3>, <Component4>... will keep scrolling till the end of page. When I scroll down, <Component2> will only be scrolled when all the <Component3> has became visible. I saw this on an Iphone app and wondered how to achieve this on Android.
I don't know if I describe clearly enough but it is same like this video
http://www.youtube.com/watch?v=jXCrM1rzLZY&feature=player_detailpage#t=71s
When the tabs scrolled up to top, it stay there. And when scrolled down like in 1:36 of that video, it stay there until all the content below has became visible on the screen.
Does anybody know how to do this on Android?

A:

I guess you could create a hidden copy of Component2 in a RelativeLayout that is setVisible(true) when the coordinates of Component2 are lower(Android draws from the top) than the top of the ScrollView.  When the coordinates of Component2 are higher than the top of the ScrollView (.getTop()), Component2Copy.setVisible(false).
You may also want to disable them when changing their visibility.  Good luck with this.

