gpt4 book ai didi

Android自定义圆形ProgressBar方向

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:46:04 24 4
gpt4 key购买 nike

我有一个自定义的循环进度条。这是我确定的可绘制对象:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/secondaryProgress">
<shape
android:innerRadiusRatio="6"
android:shape="ring"
android:thicknessRatio="20.0"
android:useLevel="true">
<gradient
android:centerColor="#999999"
android:endColor="#999999"
android:startColor="#999999"
android:type="sweep" />
</shape>
</item>
<item android:id="@android:id/progress">
<rotate
android:fromDegrees="270"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="270">

<shape
android:innerRadiusRatio="6"
android:shape="ring"
android:thicknessRatio="20.0"
android:useLevel="true">


<rotate
android:fromDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="0" />

<gradient
android:centerColor="?attr/colorAccent"
android:endColor="?attr/colorAccent"
android:startColor="?attr/colorAccent"
android:type="sweep" />

</shape>
</rotate>
</item>
</layer-list>

我想让它按顺时针方向显示进度,但现在它逆时针显示。

我该如何更改它?

最佳答案

我猜你使用的是 rtl 语言?您可以通过在 ProgressBar 上设置 layoutDirection 属性来强制进度条向 ltr 或顺时针方向移动。

<ProgressBar
...
android:layoutDirection="ltr" />

关于Android自定义圆形ProgressBar方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44884317/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com