如果收到错误,我想显示资产中的本地 HTML。但是,即使我重写 onReceivedError 方法,在资产页面显示之前,错误页面也会闪烁一秒钟。是否有针对此问题的修复或破解?
这是我的代码:
@Override
public void onReceivedError (WebView view, int errorCode, String description, String failingUrl)
{
Log.i("onReceivedError", "onReceivedError: " + failingUrl + " errorCode: " + errorCode);
super.onReceivedError(view, errorCode, description, failingUrl);
view.stopLoading();
loadFromAsset(view, failingUrl);
}