我希望创建具有样式旋转器的自定义ProgressBar,如下所示:

我尝试了以下方法来实现这一点:
layout.xml
<ProgressBar
android:id="@+id/pb_capture_video"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerInParent="true"
android:indeterminate="false"
android:max="60"
android:indeterminateDrawable="@drawable/layer_list_progress_bar_background"
android:progress="30"
android:progressDrawable="@drawable/layer_list_progress_bar_foreground"/>layer_list_progress_bar_background.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape android:shape="oval">
<stroke
android:width="1dp"
android:color="@android:color/white" />
</shape>
</item>
layer_list_progress_bar_foreground.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/progress">
<shape android:shape="oval">
<stroke
android:width="1dp"
android:color="@color/colorAccent" />
</shape>
</item>
但是,我不能展示进步。我的代码的输出如下:

我哪里出问题了吗?不管怎样,我能实现我想要的吗?
如果这似乎不是正确的方式,请再建议我一些。
发布于 2016-04-27 09:22:55
并不像你想的那么简单。您必须使用Java中的动画。这是一个解决方案。
https://stackoverflow.com/questions/36885261
复制相似问题