In iphone there are methods for getting the content offset values of a scrollview.
How can I implement this in android?
Are there any methods for getting the offset values of a scrollview in android?
In iphone there are methods for getting the content offset values of a scrollview.
How can I implement this in android?
Are there any methods for getting the offset values of a scrollview in android?
RecyclerView already has method for it. See this for Detail
mRecyclerView.computeHorizontalScrollOffset();
mRecyclerView.computeVerticalScrollOffset();
And for other then RecyclerView use
targetScrollView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
@Override
public void onScrollChanged() {
int scrollX = targetScrollView.getScrollX();
int scrollY = targetScrollView.getScrollY();
Log.d(TAG, "scrollX: " + scrollX);
Log.d(TAG, "scrollY: " + scrollY);
}
});
I think padding is what you are looking for.
You can get them from ScrollView by calling getLayoutParams on it and use the getPadding...() functions of the LayoutParams class.
http://developer.android.com/reference/android/view/View.html#getLayoutParams%28%29
http://developer.android.com/reference/android/view/View.html#getPaddingLeft%28%29