I have a simple first Android app that I am coding. One of my main activities is a ScrollView that's fairly long. In that I have some buttons that call other ListViews. When the ListViews are finished and the ScrollView is back I want the position on the screen to be the same as what it was when the ListView was first called.
I found the getScrollY() and setScrollY() methods and can implement them to keep the position the way I wish.
However, the setScrollY() is an API 14 and up function, and according to my app statistics I have a lot of users on Gingerbread, which is an older API level.
My Question: Is there a method that I have overlooked or can be pointed towards that allows me to have the same functionality as setScrollY() on the older API levels?
Have you looked at scrollTo(getScrollX(), y)
? It's available in all versions of Android.
http://developer.android.com/reference/android/view/View.html#scrollTo(int%2C%20int)
If you look at the implementation of setScrollY()
, you'll see:
public void setScrollY(int value) {
scrollTo(mScrollX, value);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With