【发布时间】:2016-08-11 08:00:40
【问题描述】:
我想在按钮内制作圆形进度条。
但我不想使用像dmytrodanylyk/circular-progress-button, etc..这样的库
我认为这个解决方案使用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"
/>
但是,进度条停止了。
第二种解决方案是使自定义按钮类具有进度条。
但我不知道要让自定义按钮类具有进度条。
【问题讨论】: