如何使自定义Indeterminate ProgressBar

时间:2011-09-19 19:01:24

标签: android layout android-widget progress-bar android-progressbar

如何在Android中更改不确定ProgressBar的样式

我需要为此进度条将颜色更改为红色:

enter image description here

有人能帮助我吗?

1 个答案:

答案 0 :(得分:5)

我得到了android源代码,所以我看到他们如何构建de spinner loader,而且它只是两个步骤

1-在您的drawable文件夹中创建一个可绘制的资源,其中包含如下图像(并将其命名为f.i my_loader)

<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/your_image_loader"
    android:pivotX="50%"
    android:pivotY="50%" />
在你的布局中

2-

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:orientation="vertical" >

    <ProgressBar
        android:id="@+id/progressBar1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:indeterminateDrawable="@drawable/my_loader" />
相关问题