gpt4 book ai didi

android - 如何制作自定义 Indeterminate ProgressBar

转载 作者:搜寻专家 更新时间:2023-11-01 07:38:23 26 4
gpt4 key购买 nike

如何在 Android 中更改不确定进度条的样式

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

enter image description here

谁能帮帮我?

最佳答案

我得到了 android 源代码,所以我看到了他们是如何构建 de spinner 加载器的,而且非常简单,只需两步

1- 在你的 drawable 文件夹中创建一个 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" />

关于android - 如何制作自定义 Indeterminate ProgressBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7475946/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com