我想要一个这样的循环进度条
我试过了,但它看起来不像圆形以及如何将动画与淡入淡出一起放置,因为目前我对所有六个圆圈使用相同的 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/