创建和使用逐帧动画
传统动漫框架相似。也有点像gif。只是做了几张照片,根据示出的顺序。
AnimationDrawable可以用来创建一个新类是由一个表示Drawable资源-frame动画,可以使用XML。在的应用res/drawable讲动画目录Drawable资源定义为外部资源。
以下看程序和效果:
<?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@drawable/h1" android:duration="500" /> <item android:drawable="@drawable/h2" android:duration="500" /> <item android:drawable="@drawable/h3" android:duration="500" /> <item android:drawable="@drawable/h4" android:duration="500" /> </animation-list>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<ImageView android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/line_gradient"
/>
</RelativeLayout>
因为CSDN不知道咋上传动态图,所以,,。没有上传。
我们自己的实验了。
。
版权声明:本文博客原创文章,博客,未经同意,不得转载。
浙公网安备 33010602011771号