I suspect that mapWebView.loadUrl("file:///android_asset/maps/map.html");
is asynchronous, so mapWebView.scrollTo(300, 300);
executes before the webview has finished loading. Once the page loads it will have lost the scroll setting you applied and will be reset to the top.
You need to listen in for the the page loading and then scroll it:
mapWebView.setWebViewClient(new WebViewClient(){
@Override
public void onPageFinished(WebView view, String url) {
// TODO Auto-generated method stub
super.onPageFinished(view, url);
mapWebView.scrollTo(300, 300);
}
}
);
Hope this helps
EDIT: Turns out this is unreliable, use this instead:
mapWebView.setPictureListener(new PictureListener() {
@Override
public void onNewPicture(WebView view, Picture picture) {
mapWebView.scrollTo(300, 300);
}
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…