My question is very similar to this unanswered one, with some small differences that I will explain:
TabHost inside of a Scrollview: always scrolls down when a Tab is clicked
My ScrollView initiates scrolled to the bottom, showing the TabHost content instead of the ones on top of it (you can see the screenshots in the linked question, it's very similar).
If I manually scroll up, clicking in different tabs doesn't affect the ScrollView, the problem is only in the first time it's shown. This is the difference between the other question.
Things I tried with no success:
- Make the top components inside the ScrollView focusable, so they would get the focus instead of the tab.
- Force the ScrollView to scroll to the top in
onResume()
method withsv.fullScroll(View.FOCUS_UP);
orsv.scrollTo(0, 0);
. Also, no luck in the initialization, but subsequent calls toonResume()
effectively scrolls it to the top.
Any ideas on why this is happening? Tips on how to further investigate are also very welcome.