圆形ProgressBar不必要的间距

时间:2019-06-19 09:37:40

标签: android android-progressbar

在我的布局中,有ProgressBar

android:layout_width="30dp"
android:layout_height="30dp"

未设置marginspaddings
但是ProgressBar并没有占据整个边界框,圆周围存在奇怪的间隙。

enter image description here

如何使ProgressButton符合指定的尺寸?

1 个答案:

答案 0 :(得分:0)

enter image description here

您可以使用android:clipChildren="false"使其在父对象上溢出

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipChildren="false">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="50dp"
        android:background="@color/colorPrimary"
        android:gravity="center_horizontal"
        android:orientation="vertical">

        <ProgressBar
            android:layout_width="390dp"
            android:layout_height="match_parent"
            android:layout_gravity="center_horizontal"
            android:layout_marginLeft="55dp"
            android:layout_marginRight="50dp" />
    </LinearLayout>


</RelativeLayout>