带有实心圆圈的自定义循环进度条

时间:2015-05-15 05:52:22

标签: 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>

任何帮助都会非常感激。

1 个答案:

答案 0 :(得分:3)

定义进度条,如beloew code snip:

<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

相关问题