Então, galera. Estou com um problema, Estou criando uma aplicação e, enquanto a webview é carregada, aparece um ProgressBar carregando antes do conteudo, veja meu codigo. O problema é que, ao iniciar o app, Existe uma activity branca no lugar do webview w o ProgressBar não aparece. Segue o código.
Minha ACTIVITY:
<FrameLayout
android:id="@+id/framelayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webView"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:visibility="invisible"/>
<ProgressBar
android:id="@+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="invisible"/>
</FrameLayout>
</RelativeLayout>
AGORA MINHA CLASSE:
` // CODIGO DO WEB VIEW
final WebView myWebView = (WebView) findViewById(R.id.webView);
myWebView.loadUrl("http://www.idestudos.com.br");
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setSupportZoom(true);
webSettings.setBuiltInZoomControls(true);
myWebView.setWebViewClient(new MyBrowser());
myWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return false;
}
});
myWebView.setWebViewClient(new WebViewClient(){
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon){
ProgressBar pb = (ProgressBar) findViewById(R.id.progress);
pb.setVisibility(View.VISIBLE);
}
public void onPageFinished(WebView view, String url){
ProgressBar pb = (ProgressBar) findViewById(R.id.progress);
pb.setVisibility(View.INVISIBLE);
myWebView.setVisibility(View.VISIBLE);
}
});
}`