1

I've been wanting to create a ScrollView that could adapt its current scroll position in respect to changes in its child's size. So that if my user has scrolled, say, 75% of the child's height at a time, they will still be at 75% of the child's updated height when it increases/decreases.

To do this, obviously my ScrollView needs to know when its child size is being updated. This seems like a trivial task at first, but unfortunately every method I tried so far has yield no result:

  • Using an OnLayoutChangeListener
  • Overriding onLayout()
  • Overriding onSizeChanged()
  • Overriding onScrollChanged()

All of them reports size changes of the ScrollView itself; not its child. This information is useless for me because my ScrollView is not supposed to change sizes.

Any feedback will be greatly appreciated.


p.s., I understand that this answered question might looks similar to mine. But my case demands no intervention of components other than the ScrollView itself, while the question above needs the ScrollView to be notified by an outside entity (presumably an Activity).

Community
  • 1
  • 1
Hadi Satrio
  • 4,272
  • 2
  • 24
  • 45
  • see [this](http://pastebin.com/qd2TvFsM) – pskink Aug 04 '16 at 06:23
  • I got the general idea.. But if you want to add it into that snippet then please do. Also, you might consider turning this comment into an answer so that I could mark it as accepted. – Hadi Satrio Aug 04 '16 at 08:42

0 Answers0