1. 程式人生 > >Android基礎-ImageView設定動圖

Android基礎-ImageView設定動圖

建立動態xml檔案

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:drawable="@drawable/call_received_move_white_1"
        android:duration="200"></item>
    <item
        android:drawable="@drawable/call_received_move_white_2"
android:duration="200">
</item> <item android:drawable="@drawable/call_received_move_white_3" android:duration="200"></item> </animation-list>

動圖被圓圈包圍著

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<padding android:bottom="1dp" android:left="2dp" android:right="2dp" android:top="1dp" /> <stroke android:width="1dp" android:color="@android:color/white" /> <size android:width="15dp" android:height
="15dp" />
</shape>

給ImageView設定src

        <ImageView
            android:layout_width="150dp"
            android:layout_height="150dp"
            android:background="@drawable/shape_circle"
            android:padding="15dp"
            android:src="@drawable/anim_call_received" />