I have a ScrollView
with a RelativeLayout
as its only child.
Lately I noticed that the method:
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {}
is called even when the child height is less than the ScrollView
height as you can see below:
this refers to my ScrollView
and rl refers to the RelativeLayout
.
Is this a normal behavior or am I missing something?
Edit:
I'm constantly adding and removing views from the RelativeLayout
so disabling the scroll/touch etc. each time doesn't seem like a good solution.
My current fix is to check whether the scroll actually changed anything, if not, I'm just ignoring it:
// in case no actual scroll has occurred - just return.
if (t == oldt && l == oldl) {
return;
}
This is a normal behavior
If you want to stop ScrollView Scrolling then you must try this
scroll.setEnabled(false);
scroll.setFocusable(false);
scroll.setHorizontalScrollBarEnabled(false);
scroll.setVerticalScrollBarEnabled(false);
Hope so this will work