Advertisement
Ahmed_Zouhir

WebView ProgressBar by Ahmed Zouhir

Nov 16th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1. //hello everyone this the code used for creating //webview ProgressBar feel free to use it 😊
  2. //note that this code will only work in android
  3. //instructions : just create linear layout and name it //as pl
  4. //happy coding
  5.  
  6.  
  7.  final android.widget.ProgressBar prog = new android.widget.ProgressBar(this,null, android.R.attr.progressBarStyleHorizontal);
  8. prog.setPadding(0,0,0,0);
  9. prog.setIndeterminate(false);
  10. prog.setFitsSystemWindows(true);
  11. prog.setProgress(0);
  12. prog.setScrollBarStyle(android.widget.ProgressBar.SCROLLBARS_OUTSIDE_INSET);
  13. prog.setMax(100);
  14. ViewGroup.LayoutParams vlp = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
  15. prog.setLayoutParams(vlp);
  16. pl.addView(prog);
  17. webview1.setWebChromeClient(new WebChromeClient() {
  18. @Override public void onProgressChanged(WebView view, int newProgress) {
  19. prog.setProgress(newProgress);
  20. }
  21. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement