When making some changes to the ScrollView, it takes some time for it to replicate the layout changes to the display list and notify ScrollView that it is indeed allowed to scroll to the position.
I managed to get it to work by extending the ScrollView with a ScrollView of my own and adding a method that adds OnGlobalLayoutListener (as suggested by MH) as needed and scrolls it later. This is a bit more automated than applying it for every case you need (but then you need to use the new ScrollView ). Anyway, this is the corresponding code:
public class ZScrollView extends ScrollView {
Very useful for me, since I wanted to scroll to a specific view inside the ScrollView immediately after adding it.
zeh
source share