Android ProgressBar使渐变淡入透明
这是目前的情况 注意粉红色是如何褪色为背景色的。这不仅仅是因为背景是灰色的(这只是Android Studio中布局预览的一个剪贴画),因为即使在有白色背景的应用程序中,它也会逐渐变为黑色 我想要实现的是粉红色逐渐变为透明,因此随着渐变中粉红色的数量减少,更多的背景变得可见 有人知道如何做到这一点吗 以下是进度条的可绘制图形:Android ProgressBar使渐变淡入透明,android,gradient,fade,progress,Android,Gradient,Fade,Progress,这是目前的情况 注意粉红色是如何褪色为背景色的。这不仅仅是因为背景是灰色的(这只是Android Studio中布局预览的一个剪贴画),因为即使在有白色背景的应用程序中,它也会逐渐变为黑色 我想要实现的是粉红色逐渐变为透明,因此随着渐变中粉红色的数量减少,更多的背景变得可见 有人知道如何做到这一点吗 以下是进度条的可绘制图形: <?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas
<?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:toDegrees="360">
<shape
android:innerRadiusRatio="3"
android:shape="ring"
android:thicknessRatio="30"
android:useLevel="false">
<gradient
android:centerColor="#00000000"
android:centerY="0.50"
android:endColor="@color/colorAccent"
android:startColor="@color/colorAccent"
android:type="sweep"
android:useLevel="false" />
</shape>
这是我的布局中的声明:
<ProgressBar
android:layout_width="210sp"
android:layout_height="210sp"
style="?android:attr/progressBarStyleLarge"
android:indeterminateDrawable="@drawable/circular_progress_bar_big"
android:indeterminate="false"
android:id="@+id/progressPose"
android:layout_gravity="center"
android:visibility="visible"
android:progress="100" />
感谢您的帮助!
Max对于颜色的透明度,使用此答案
- 100%-FF
- 95%-F2
- 90%-E6
- 85%-D9
- 80%-CC
- 75%高炉
- 70%-B3
- 65%-A6
- 60%-99
- 55%-8摄氏度
- 50%-80
- 45%-73
- 40%-66
- 35%-59
- 30%-4D
- 25%-40
- 20%-33
- 15%-26
- 10%-1A
- 5%-0D
- 0%-00
<?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:toDegrees="360">
<shape
android:innerRadiusRatio="3"
android:shape="ring"
android:thicknessRatio="30"
android:useLevel="false">
<gradient
android:centerColor="#00000000"
android:centerY="0.50"
android:endColor="@color/colorAccent"
android:startColor="@color/colorAccent"
android:type="sweep"
android:useLevel="false" />
</shape>
</rotate>
color.xml
占50%
<color name="colorAccent">#80FF4081</color>
#80FF4081
85%-D9
<color name="colorAccent">#D9FF4081</color>
#D9FF4081
等等。您使用…谢谢,完美的解决方案。是的,我确实有!