android - 带有实心圆的自定义圆形进度条

标签 android progress-bar

我想要一个这样的循环进度条

enter image description here

我试过了,但它看起来不像圆形以及如何将动画与淡入淡出一起放置,因为目前我对所有六个圆圈使用相同的 xml。

 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal" >

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

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="5dp"
        android:src="@drawable/circle_shape_big_custom_search" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:src="@drawable/circle_shape_big_custom_search" />
</LinearLayout>

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

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="72dp"
        android:src="@drawable/circle_shape_big_custom_search" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="72dp"
        android:src="@drawable/circle_shape_big_custom_search" />
</LinearLayout>

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

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
         android:layout_marginBottom="5dp"
        android:src="@drawable/circle_shape_big_custom_search" />

    <ImageView
        android:layout_width="wrap_content"
         android:layout_marginTop="5dp"
        android:layout_height="wrap_content"
        android:src="@drawable/circle_shape_big_custom_search" />
</LinearLayout>

非常感谢任何帮助。

最佳答案

像下面的代码 fragment 一样定义进度条:

<ProgressBar
        android:id="@+id/progress_bar"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_gravity="center"
        android:indeterminateDrawable="@drawable/my_progress_indeterminate"
        android:visibility="gone" >
    </ProgressBar>

my_progress_indeterminate.xml [将此文件放在 drawable 中]

<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/image_for_rotation"
    android:pivotX="50%"
    android:pivotY="50%" />

将此图像文件放在 drawale 中: image_to_be_place_in_drawable

关于android - 带有实心圆的自定义圆形进度条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30252437/

相关文章:

android - DBFlow Android 选择最常见的值

java - 微光动画在加载 RecyclerView 时不会停止

ios - ios自定义进度条

android - 如何为 Google Maps Android API UrlTileProvider 设置 SSL 证书?

android - 从 Kotlin 中的构造函数注入(inject) Koin

html - 如何为我的 CSS 进度条制作动画?

mysql - 进度条

php - 如何找到两个时间戳之间的百分比

java - 使用 SugarORM 创建多个表会出现 IllegalStateException

android - CheckedTextView 中的复选框