AnimationDrawabl的使用
2016-01-06 11:18
155 查看
自己写个帧动画zhuzhen
android:oneshot=”false”的意思是循环播放
2.首先给图片设置
AnimationDrawable anim= (AnimationDrawable) iv.getBackground();
anim.start();
注意点:anim.start();不能直接放入oncreate里面,,还没有真正的焦点获取
如果想启动界面自动执行start()的话 需要放入:onWindowFocusChanged里面
<?xmlversion="1.0"encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false"> <itemandroid:drawable="@drawable/progress_1"android:duration="200"/> <itemandroid:drawable="@drawable/progress_2"android:duration="200"/> <itemandroid:drawable="@drawable/progress_3"android:duration="200"/> <itemandroid:drawable="@drawable/progress_4"android:duration="200"/> <itemandroid:drawable="@drawable/progress_5"android:duration="200"/> <itemandroid:drawable="@drawable/progress_6"android:duration="200"/> <itemandroid:drawable="@drawable/progress_7"android:duration="200"/> <itemandroid:drawable="@drawable/progress_8"android:duration="200"/> </animation-list>
android:oneshot=”false”的意思是循环播放
2.首先给图片设置
<ImageView android:id="@+id/iv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@anim/zhuzhen" android:layout_gravity="center"/>
AnimationDrawable anim= (AnimationDrawable) iv.getBackground();
anim.start();
注意点:anim.start();不能直接放入oncreate里面,,还没有真正的焦点获取
如果想启动界面自动执行start()的话 需要放入:onWindowFocusChanged里面
相关文章推荐
- eclipse git 解决冲突
- 在 Golang 中使用 Protobuf
- SpringMVC学习系列之 基于Hibernate+Spring+Spring MVC+Bootstrap的管理系统实现
- 兰州烧饼(南阳oj779)
- PHP判断PC端或移动端
- 这是最坏的时代,也是最好的时代
- std::priority_queue
- android中的AIDL进程间通信
- BlockingQueue简介及使用
- CTypedPtrList
- Clojure环境的搭建
- [转载] 之前碰过的木马分析
- onCreate的savedInstanceState和onRestoreInstanceState 方法的区别。
- Java 实验:常用类
- SecureCRT的使用
- ios原生api识别二维码图片
- cas 服务器安装
- UIWindow
- android 二级ListVew--ExpandableListView
- linux ubunt install package