【发布时间】:2018-04-06 10:07:29
【问题描述】:
我想用全高/全宽 webview 将进度条完全居中,但我做不到。这是我的 xml 代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.stevejobs.iphone.MainActivity">
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webview"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<ProgressBar
style="?android:attr/progressBarStyle"
android:id="@+id/progressBar"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_centerInParent="true"
android:foregroundGravity="center"/>
</WebView>
</RelativeLayout>
我是否在此处遗漏了任何一行以使其居中?进度条现在出现在左上角。
【问题讨论】:
-
如果删除 WebView 的最后三行会怎样?
-
@Orionss 我也试过了,但什么也没发生
标签: android android-layout android-webview android-view android-gravity