我有一个webview
个应用。我面临的问题是它没有在页面上完成。它应该在页面完成后上升,但它会卡在中心。请帮帮我!
不工作
webView.setWebViewClient(new WebViewClient() {
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
@Override
public void onPageFinished(WebView view, String url) {
if (pageFinished) {
swipe.setRefreshing(false);
animate(view);
showFreeze = false;
webView.setVisibility(View.VISIBLE);
}
if (url.contains("error.html")) {
currentUrl = "https://website";
} else {
currentUrl = url;
}
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
pageFinished = true;
/////////////////////////// THIS ONE NOT WORKING /////////////////////////////
webView.pageUp(true);
}
}, 250);
super.onPageFinished(view, url);
}
});
}
答案 0 :(得分:0)
@Override
public void doUpdateVisitedHistory(WebView view, String url, boolean isReload) {
super.doUpdateVisitedHistory(view, url, isReload);
try {
mWebView.postDelayed(new Runnable() {
@Override
public void run() {
mWebView.scrollTo(0, 0);
}
}, 200);
}catch (Exception ignored){}
}
希望对您有所帮助。