如何制作水平进度条动画?

时间:2015-04-23 13:44:41

标签: android android-animation android-progressbar

我想制作一个动画,显示3个点,逐渐增加和减少 但我只是一个坚实的灰色椭圆

我试过了:

<ProgressBar
        android:layout_width="match_parent"
        android:layout_height="30dip"
        android:layout_alignParentBottom="true"
        android:indeterminateOnly="true"
        style="@android:style/Widget.ProgressBar.Horizontal"
        android:indeterminateDrawable="@drawable/new_new_anim" />

new_new_anim.xml

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false">
    <item android:duration="100" android:drawable="@drawable/first_frame"/>
    <item android:duration="100" android:drawable="@drawable/second_frame"/>
    <item android:duration="100" android:drawable="@drawable/third_frame"/>
    <item android:duration="100" android:drawable="@drawable/third_frame"/>
    <item android:duration="100" android:drawable="@drawable/second_frame"/>
    <item android:duration="100" android:drawable="@drawable/first_frame"/>
</animation-list> 

first_frame.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:left="0dp"
        android:right="54dp"
        android:top="3dip"
        android:bottom="3dip">
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="oval">

            <solid android:color="@color/black_80" />

            <size
                android:width="6dip"
                android:height="6dip" />
        </shape>
    </item>
    <item
        android:left="23dp"
        android:top="2dip"
        android:bottom="2dip"
        android:right="29dp">
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="oval">

            <solid android:color="#00FFFFFF" />

            <size
                android:width="8dip"
                android:height="8dip" />
        </shape>
    </item>
    <item
        android:left="48dp"
        android:right="0dp">
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="oval">

            <solid android:color="#00FFFFFF" />

            <size
                android:width="12dip"
                android:height="12dip" />

        </shape>

    </item>


</layer-list>

second_frame.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:left="0dp"
        android:right="54dp"
        android:top="3dip"
        android:bottom="3dip">
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="oval">

            <solid android:color="#00FFFFFF" />

            <size
                android:width="6dip"
                android:height="6dip" />
        </shape>
    </item>
    <item
        android:left="23dp"
        android:top="2dip"
        android:bottom="2dip"
        android:right="29dp">
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="oval">

            <solid android:color="@color/black_80" />

            <size
                android:width="8dip"
                android:height="8dip" />
        </shape>
    </item>
    <item
        android:left="48dp"
        android:right="0dp">
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="oval">

            <solid android:color="#00FFFFFF" />

            <size
                android:width="12dip"
                android:height="12dip" />

        </shape>

    </item>


</layer-list>

third_frame.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:left="0dp"
        android:right="54dp"
        android:top="3dip"
        android:bottom="3dip">
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="oval">

            <solid android:color="#00FFFFFF" />

            <size
                android:width="6dip"
                android:height="6dip" />
        </shape>
    </item>
    <item
        android:left="23dp"
        android:top="2dip"
        android:bottom="2dip"
        android:right="29dp">
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="oval">

            <solid android:color="#00FFFFFF" />

            <size
                android:width="8dip"
                android:height="8dip" />
        </shape>
    </item>
    <item
        android:left="48dp"
        android:right="0dp">
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="oval">

            <solid android:color="@color/black_80" />

            <size
                android:width="12dip"
                android:height="12dip" />

        </shape>

    </item>


</layer-list>

0 个答案:

没有答案