我有一个进度条,我会向用户显示直到加载完成。很好,但是布局中间有一个白色矩形,我想删除它。
我只希望在布局中间旋转的ProgressBar。
如何删除此白色矩形?
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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="match_parent"
android:background="@android:color/transparent">
<ProgressBar
android:id="@+id/progress_bar"
android:paddingTop="5sp"
android:paddingBottom="5sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:indeterminateDrawable="@drawable/progress_bar"
android:max="100"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
这是进度条可绘制对象
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="200"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="1080" >
<shape
android:innerRadius="18dp"
android:shape="ring"
android:thickness="4dp"
android:useLevel="false" >
<size
android:height="48dp"
android:width="48dp" />
<gradient
android:centerColor="@color/colorPrimary"
android:endColor="#ffffff"
android:startColor="@color/colorPrimary"
android:centerY="0.5"
android:type="sweep"
android:useLevel="false" />
</shape>
</rotate>