Webview Progress Bar Sketchware
hello everyone this tutorial will be about how to add ProgressBar to your webview app,
well its very easy only you need to
- Add linear and name it to pl
- copy this code and paste it in onCreate logic
code :
final android.widget.ProgressBar prog = new android.widget.ProgressBar(this,null, android.R.attr.progressBarStyleHorizontal);
prog.setPadding(0,0,0,0);
prog.setIndeterminate(false);
prog.setFitsSystemWindows(true);
prog.setProgress(0);
prog.setScrollBarStyle(android.widget.ProgressBar.SCROLLBARS_OUTSIDE_INSET);
prog.setMax(100);
ViewGroup.LayoutParams vlp = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
prog.setLayoutParams(vlp);
pl.addView(prog);
webview1.setWebChromeClient(new WebChromeClient() {
@Override public void onProgressChanged(WebView view, int newProgress) {
prog.setProgress(newProgress);
}
});
Comments
Post a Comment