Android之帧动画达成
发布时间:2021-11-24 19:18:30 所属栏目:教程 来源:互联网
导读:今天实现了一个帧动画的例子,首先在res/anim下建立一个frame.xml来存放帧动画 ?xml version=1.0 encoding=utf-8? animation-list xmlns:Android=http://schemas.android.com/apk/res/android android:oneshot=false item android:drawable=@drawable/girl_1
|
今天实现了一个帧动画的例子,首先在res/anim下建立一个frame.xml来存放帧动画 <?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:Android="http://schemas.android.com/apk/res/android" android:oneshot="false"> <item android:drawable="@drawable/girl_1" android:duration="100"/> <item android:drawable="@drawable/girl_2" android:duration="100"/> <item android:drawable="@drawable/girl_3" android:duration="100"/> <item android:drawable="@drawable/girl_4" android:duration="100"/> <item android:drawable="@drawable/girl_5" android:duration="100"/> <item android:drawable="@drawable/girl_6" android:duration="100"/> <item android:drawable="@drawable/girl_7" android:duration="100"/> <item android:drawable="@drawable/girl_8" android:duration="100"/> <item android:drawable="@drawable/girl_9" android:duration="100"/> <item android:drawable="@drawable/girl_10" android:duration="100"/> <item android:drawable="@drawable/girl_11" android:duration="100"/> </animation-list> 引用的是drawable下面的图片,duration是设置时间是100毫秒 看下main.xml的布局 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> <LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" > <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="播放动画" /> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="停止动画" /> </LinearLayout> <RadioGroup android:id="@+id/radioGroup1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" > <RadioButton android:id="@+id/radioButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text="单次播放" /> <RadioButton android:id="@+id/radioButton2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="循环播放" /> </RadioGroup> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="拖动进度条修改透明度(0 - 255)之间" /> <SeekBar android:id="@+id/seekBar1" android:layout_width="match_parent" android:layout_height="wrap_content" /> <ImageView android:id="@+id/imageView1" android:layout_width="200dip" android:layout_height="200dip" android:background="@anim/frame" /> </LinearLayout> ![]() (编辑:济南站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |





