【问题标题】:How to make custom Indeterminate ProgressBar如何制作自定义 Indeterminate ProgressBar
【发布时间】:2011-11-20 12:22:12
【问题描述】:

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

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

谁能帮帮我?

【问题讨论】:

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


【解决方案1】:

我得到了 android 源代码,所以我看到了他们如何构建 de spinner loader,并且非常简单,只需两步

1- 在你的可绘制文件夹中创建一个可绘制资源,如下图所示(并将其命名为 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" />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-26
    • 2018-12-08
    • 1970-01-01
    • 1970-01-01
    • 2021-12-16
    相关资源
    最近更新 更多