自定义不确定进度条

时间:2014-08-11 07:01:01

标签: android progress-bar

我成功实现了这一进步 enter image description here

将动画列表与这样的资源一起使用: enter image description here enter image description here enter image description here

但问题是,我不能用这些资源来阻止半高的进步。

我已经尝试过半高加工资源,重力垂直居中,如下所示: enter image description here enter image description here enter image description here

但结果是 enter image description here

Android将此进展推向了最低点。 任何想法我如何能够集中我的半成就进步? Thx提前。

@Antoine Marques 我已经尝试了9个补丁画画,但我得到了这样的想法 enter image description here

这是我的动画列表:

<item android:duration="200" android:drawable="@drawable/progressbar_indeterminate1_0" />

资源示例: enter image description here

1 个答案:

答案 0 :(得分:1)

问题的解决方案是将自定义进度包装在ScaleDrawable

<scale xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/my_custom_progress"
    android:scaleGravity="center_vertical|center_horizontal"
    android:scaleHeight="100%"
    android:scaleWidth="100%" />
相关问题