views:

14

answers:

1

How can I know which childview is shown on the current device screen, in a scrollview?

I want to make an infinite Ruler App, so I need to dynamically add and remove view when the view is flipping, but how and where can I find out which childview is shown on the current device screen, so I can add or remove the correct view when I get that childview changed notify?

Or, can anyone who can give me some other idea to realize this function?

A: 

Use scrollView.getScrollY() to find how far down the scroll view the scroll point is, and compare that to the heights of the child views (adding them up as you go along) to see which one must be on screen.

oli
thanksgetScrollY() maybe right.I just found anyview have scrollTo() function,so now i immediately use lineanerlayout instead ScrollView