/res/drawable下添加progress_style.xml

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <layer-list xmlns:andro>
 3     <item android:>
 4         <shape>
 5             <gradient android:startColor="#eeee" android:endColor="#eeee" />
 6         </shape>
 7     </item>
 8     <item android:>
 9         <clip>
10             <shape>
11                 <gradient android:startColor="#0000ff" android:endColor="#0000ff" android:centerColor="#0000ff" />
12             </shape>
13         </clip>
14     </item>
15 </layer-list>

 

布局文件中添加progressbar

1 <ProgressBar
2             android:
3             style="?android:attr/progressBarStyleHorizontal"
4             android:layout_width="match_parent"
5             android:layout_height="3dp"
6             android:progressDrawable="@drawable/progress_style" />

 

view.setWebChromeClient(new WebChromeClient() {

            @Override
            public void onProgressChanged(WebView view, int position) {
                mypProgressBar.setProgress(position);
                if (position == 100) {
                    progressBarLayout.setVisibility(View.GONE);
                }
                super.onProgressChanged(view, position);
            }

        });

相关文章:

  • 2021-09-17
  • 2021-11-11
  • 2022-01-15
  • 2021-12-08
  • 2021-06-10
  • 2022-12-23
  • 2021-06-23
  • 2022-12-23
猜你喜欢
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2021-05-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案