カスタムWebChromeClientを作成し、そのonReceivedIcon()メソッドまたはonProgressChanged()メソッドをオーバーライドする方法について説明します。 favIconがロードされ、onProgressChanged()を使用すると、onReceivedIcon()がトリガされ、webviewの読み込みの進行状況を問い合わせることができます。私はあなたがそれはあなたのニーズに合ったものは何でもonReceivedIcon onProgressChanged使用したりすることができます
webView.setWebChromeClient(new CustomWebChromeClient());
をスニペットこのコードを参照してください、これは
に役立ちます願っています。
public class CustomWebChromeClient extends WebChromeClient {
@Override
public void onProgressChanged(WebView view, int newProgress) {
super.onProgressChanged(view, newProgress);
if (newProgress==100) {
progressBar.setVisibility(View.GONE);
progressBar.setProgress(newProgress);
}
}
@Override
public void onReceivedIcon(WebView view, Bitmap icon) {
// icon received here
super.onReceivedIcon(view, icon);
}
}
私は必ずしもそれが助けになるとは思わない。画像やその他のリソースがロードされる前にスクリプトが実行されます。 –