I have a template in a webview
Mainacitivity
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView myWebView = (WebView) findViewById(R.id.web_engine);
myWebView.setWebViewClient(new MyBrowser());
myWebView.clearCache(true);
myWebView.clearHistory();
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.getSettings().setLoadsImagesAutomatically(true);
myWebView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
myWebView.loadUrl("http://www.mundodamulher.com.br/");
}
private class MyBrowser extends WebViewClient {
@Override
public void onPageFinished(WebView view, String url) {
if (findViewById(R.id.splach_screen).getVisibility() == View.VISIBLE) {
// show webview
findViewById(R.id.main_view).setVisibility(View.VISIBLE);
// hide splash screen
findViewById(R.id.splach_screen).setVisibility(View.GONE);
}
}
}
}
activity_main
<?xml version="1.0" encoding="utf-8"?>
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="160dp"
android:layout_height="10dp"
android:id="@+id/webViewProgress"
android:indeterminateOnly="true"
android:max="100"
android:indeterminateTint="#e20400"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
<LinearLayout
android:id="@+id/main_view"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="invisible"
>
<WebView android:id="@+id/web_engine"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
I know the color change of the bar works above api 21, yet to looking for lower api’s
Have you seen: Add progressbar to my webview ?
– Zuul
That there was in webview, now I want before the call of a listview, I could not implement, I want to do with thread
– War Lock
Someone can help me?
– War Lock
Is this what you want? http://stackoverflow.com/a/7496195/1817673
– Jorge B.
@Warlock Consider posting an answer if you succeeded, and how you managed to solve your problem. Also because two comments offered you a help.
– Ismael