【发布时间】:2014-07-06 06:19:34
【问题描述】:
刚刚测试了新的开发者预览版,发现我现有的环形可绘制对象无法正确渲染。它不是一个环,而是一个完整的圆圈。它是一个错误还是发生了某些变化,或者我一开始就做错了?任何可能的解决方案?
代码如下:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@android:id/progress">
<shape
android:innerRadiusRatio="3"
android:shape="ring"
android:thicknessRatio="7.0">
<solid android:color="#ff5698fb"/>
</shape>
</item>
</layer-list>
谢谢!
更新
我已将形状更新如下:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape
android:innerRadiusRatio="3"
android:shape="ring"
android:thicknessRatio="7.0">
<solid android:color="#ff5698fb"/>
</shape>
</item>
<item >
<shape
android:innerRadiusRatio="4"
android:shape="ring"
android:thicknessRatio="5.5">
<solid android:color="#ffffff"/>
</shape>
</item>
</layer-list>
通过重叠两个圆圈产生一个环。但是我使用它的进度条不起作用。 这是进度条的代码:
<ProgressBar
android:id="@+id/progressCircle"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:indeterminate="false"
android:max="100"
android:progress="65"
android:rotation="270"
android:progressDrawable="@drawable/progress_circle"
android:visibility="visible"/>
【问题讨论】:
-
这个你搞定了吗?我的代码和你的几乎一样——基本上是一个自定义的圆形进度条。现在当我调用 updateProgress() 时,它似乎没有任何效果,并且进度保持在 100%。它在以前的 Android 版本中运行良好,但 Android L 预览版不喜欢它。
标签: android android-5.0-lollipop