我想在按钮内制作圆形进度条,但我不想使用像dmytrodanylyk/circular-progress-button
这样的库。
我认为可以使用drawable
来解决。
所以,我制作了circular_progress.xml
文件,
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:duration="1"
android:toDegrees="360" >
<shape
android:innerRadiusRatio="3"
android:shape="ring"
android:thicknessRatio="8"
android:useLevel="false" >
<size
android:height="48dip"
android:width="48dip" />
<gradient
android:centerColor="#f0f0f0"
android:centerY="0.50"
android:endColor="#000000"
android:startColor="#ffffff"
android:type="sweep"
android:useLevel="false" />
</shape>
</rotate>
并且,
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Log In"
android:layout_below="@+id/passwordWrapper"
android:layout_marginTop="5dp"
android:theme="@style/AppTheme.SignButton"
android:id="@+id/loginButton"
android:drawableRight="@drawable/circular_progress"
/>
但是,进度条已停止。
第二个解决方案是创建一个带有进度条的自定义按钮类。
但我不知道如何创建带有进度条的自定义按钮类。