【发布时间】:2020-01-13 12:08:51
【问题描述】:
进度条出现在屏幕左侧。我希望它居中,就像在示例中一样。
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:gravity="center"
android:background="@drawable/semi_circle"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginTop="50dp"
android:layout_gravity="center_horizontal"
android:id="@+id/relative">
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="visible" />
<LinearLayout android:layout_width="match_parent"
android:id="@+id/lilPolicy"
android:layout_height="match_parent"
android:layout_marginBottom="20dp">
</LinearLayout>
【问题讨论】:
-
你能分享完整的布局代码
-
添加 android:layout_centerInParent="true" 属性使其居中。
标签: android android-layout android-relativelayout android-scrollview android-progressbar