I have a ScrollView
which is programatically filled with LinearLayouts
. When user changes between tabs, there is an ID stored in sharedPreferences
which is used to get LinearLayout
from hashMap. This Layout is then colored.
I also want to automatically scroll to this layout. Basically everything I want is "Y position" of given layout, so I can use it with scrollView.scrollTo(0, Y);
EDIT: somehow @basic 's solution is not working if layouts are added programatically. It scrolls, but it is far fro being accurate.
int scrollY = targetScrollView.getScrollY();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.