Android中的AnimationDrawable的使用
2015-09-18 21:12
465 查看
<?xml version="1.0" encoding="utf-8"?> 2 <animation-list xmlns:android="http://schemas.android.com/apk/res/android" 3 android:oneshot="false" > 4 5 <item 6 android:drawable="@drawable/on_001" 7 android:duration="100"/> 8 9 <item 10 android:drawable="@drawable/on_002" 11 android:duration="100"/> 12 13 <item 14 android:drawable="@drawable/on_003" 15 android:duration="100"/> 16 17 <item 18 android:drawable="@drawable/on_004" 19 android:duration="100"/> 20 21 <item 22 android:drawable="@drawable/on_005" 23 android:duration="100"/> 24 25 <item 26 android:drawable="@drawable/on_006" 27 android:duration="100"/> 28 </animation-list>
然后在代码中定义出AnimationDrawable对象,并设置到view的background上,然后设置开始播放就可以了:
AnimationDrawable ad = (AnimationDrawable) getResources().getDrawable( 2 R.drawable.bootanimation); 3 mView.setBackgroundDrawable(ad); 4 ad.start();
相关文章推荐
- android BrocadcastReceiver
- 左右 android AES 所述机器的一部分 javax.crypto.BadPaddingException: pad block corrupted
- android通讯录根据首字母分组(二)
- android使用自定义字体
- Android4.1添加新的按键(2)
- Android4 .1添加新的按键(1)
- Android4.1添加新的按键(3)
- android下载图片显示总结
- Android开发环境的调研
- Android之ADB常用命令
- 弄明白Android 接口回调机制
- Android Studio配置Esri ArcGIS
- Android四大组件
- android通讯录根据首字母分组(一)
- 使用AutoCompleteTextView和MultiAutoCompleteTextView实现输入自动匹配
- Android——Hander和AsyncTask的使用
- Android四大组件——Service详解
- Android内存管理、Android中Dalvik和JVM的区别
- ubuntu14.04下载android source code
- android 开发 小技巧