Bom*_*Bus 10 deprecated android-webview
我想在加载android webview时显示进度条,我使用了Activity.setProgess(int).
Android文档说,在API级别24中不推荐使用setProgress(int progress).不再支持从API 21开始.
那么,在加载webview时我应该使用什么来显示进度呢?
实现带有进度条或微调器的工具栏。
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_actionbar"
style="@style/HeaderBar"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:visibility="visible"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ActionBarPopupThemeOverlay"
app:theme="@style/ActionBarThemeOverlay"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:gravity="right"
android:divider="?android:dividerVertical"
android:dividerPadding="8dp"
android:orientation="horizontal"
android:showDividers="beginning|middle">
<ProgressBar
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:id="@+id/toolbarProgressBar"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</android.support.v7.widget.Toolbar>
Run Code Online (Sandbox Code Playgroud)
然后在您的视图中找到它并更新。
ProgressBar progressBar = (ProgressBar)findViewById(R.id.toolbarProgressBar);
progressBar.setIndeterminate(false);
progressBar.setProgress(x);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2479 次 |
| 最近记录: |