I have a webview in a scrollview, when the Activity loads, it forces my scrollview to the bottom (where the webview is) once the webview finishes "loadData". How do I keep this from happening? I've tried this, but it jumps the screen up and down, which I don't want:
ScrollView scroll = (ScrollView)findViewById(R.id.detailsScroll);
scroll.post(new Runnable()
{
@Override
public void run()
{
ScrollView scroll = (ScrollView)findViewById(R.id.detailsScroll);
scroll.fullScroll(ScrollView.FOCUS_UP);
}
});
The answer of fhucho is OK for stoping the webview from scrolling to bottom. But you will lose all accessibility with trackball, etc. So I found an improvement :
public class MyScrollView extends ScrollView {
@Override
public void requestChildFocus(View child, View focused) {
if (focused instanceof WebView )
return;
super.requestChildFocus(child, focused);
}
}
Hope it helps !
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