1.Drawable Animation(帧动画)
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@mipmap/loading_image_01" android:duration="80"/>
<item android:drawable="@mipmap/loading_image_02" android:duration="80"/>
<item android:drawable="@mipmap/loading_image_03" android:duration="80"/>
<item android:drawable="@mipmap/loading_image_04" android:duration="80"/>
</animation-list>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_header"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/background_light"
android:gravity="center">
<ImageView
android:id="@+id/iv_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/loading" />
<TextView
android:id="@+id/iv_loading_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_loading"
android:layout_centerInParent="true"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="玩命加载中..."
android:textSize="18sp" />
</RelativeLayout>
ImageView loadingImage = (ImageView) findViewById(R.id.iv_loading);
loadingDrawable = (AnimationDrawable) loadingImage.getDrawable();
loadingDrawable.start();
2.View Animation(视图动画)
3.Property Animation(属性动画)
|