この問題は自分で解決しました。同じ効果を得るために別の方法を使用しました。それがベスト プラクティスかどうかはわかりませんが、私の webview レイアウトは次のようになります。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- WebView progress -->
<LinearLayout
android:id="@+id/webProgress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone" >
<ProgressBar
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp" />
<TextView
android:id="@+id/login_status_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="Loading"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:visibility="visible" />
</LinearLayout>
そして、私が使用する進行状況を表示および非表示にするには:
View webProgress = findViewById(R.id.webProgress);
...
public void showWVProgress() {
webProgress.setVisibility(View.VISIBLE);
isWVProgressShowing = true;
}
public void hideWVProgress() {
webProgress.setVisibility(View.GONE);
isWVProgressShowing = false;
}