【发布时间】:2021-02-03 10:23:16
【问题描述】:
这是我的progressBar 的 xml 布局:
<?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">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="200dp"
android:layout_height="200dp"
android:indeterminate="false"
android:indeterminateDrawable="@drawable/loading"
style="?android:attr/progressBarStyleLarge" />
</androidx.constraintlayout.widget.ConstraintLayout>
这里是 loading.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/picture">
</item>
<item>
<rotate
android:fromDegrees="270"
android:toDegrees="270">
<shape
android:innerRadiusRatio="2.5"
android:shape="ring"
android:thickness="3dp"
android:useLevel="true"><!-- this line fixes the issue for lollipop api 21 -->
<gradient
android:angle="0"
android:endColor="#007DD6"
android:startColor="#007DD6"
android:type="sweep"
android:useLevel="false" />
</shape>
</rotate>
</item>
</layer-list>
progressBar 的半径小于图片的半径。有人知道如何解决吗?谢谢。
【问题讨论】:
-
在布局中具有与
progressBar相同大小的圆形图像视图。 -
@ADM,在这种情况下,我得到的只是一张图片......没有progressBar
标签: android android-layout progress-bar android-progressbar