android 逐帧动画
来源:互联网 发布:大数据的来源包括 编辑:程序博客网 时间:2024/05/16 05:21
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"android:oneshot="false"> <item android:drawable="@drawable/main_frame_01" android:duration="100" /> <item android:drawable="@drawable/main_frame_02" android:duration="100" /> <item android:drawable="@drawable/main_frame_03" android:duration="100" /> <item android:drawable="@drawable/main_frame_04" android:duration="100" /> <item android:drawable="@drawable/main_frame_05" android:duration="100" /> <item android:drawable="@drawable/main_frame_06" android:duration="100" /> <item android:drawable="@drawable/main_frame_07" android:duration="100" /> <item android:drawable="@drawable/main_frame_08" android:duration="100" /> <item android:drawable="@drawable/main_frame_09" android:duration="100" /> <item android:drawable="@drawable/main_frame_10" android:duration="100" /> <item android:drawable="@drawable/main_frame_11" android:duration="100" /> <item android:drawable="@drawable/main_frame_12" android:duration="100" /> <item android:drawable="@drawable/main_frame_13" android:duration="100" /> <item android:drawable="@drawable/main_frame_14" android:duration="100" /> <item android:drawable="@drawable/main_frame_15" android:duration="100" /> <item android:drawable="@drawable/main_frame_16" android:duration="100" /> <item android:drawable="@drawable/main_frame_17" android:duration="100" /> <item android:drawable="@drawable/main_frame_18" android:duration="100" /> <item android:drawable="@drawable/main_frame_19" android:duration="100" /> </animation-list>写一个animation-list oneshot是否只跑一次 xmls是命名空间
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.aaa); m_RunButton=(Button)this.findViewById(R.id.Button01); m_StopButton=(Button)this.findViewById(R.id.Button02); m_RunButton.setOnClickListener( m_BtnRunClickListener); m_StopButton.setOnClickListener(m_BtnStopClickListener); imgView=(ImageView)this.findViewById(R.id.ImageView01); imgView.setBackgroundResource(R.drawable.animation); mAnimation = (AnimationDrawable) imgView.getBackground(); //startAnimation(mAnimation); }
onCreate 中 Animation 需要一个 view 所以 imgView.getBackground()返回一个view background 保证切换图片时不会重叠
animation.start() 不能写在onCreate中否则不能执行,可能系统调用view.invalidate()不能在onCreate调用的原因,否则会冲突```onCreate时
invalidate(废止)。把animation.start() 写在button的响应里。
protected void onResume() { // TODO Auto-generated method stub super.onResume(); //mHandler.postDelayed(mRunnable, START_DELAY); } private View.OnClickListener m_BtnRunClickListener=new View.OnClickListener() { public void onClick(View arg0) { // TODO Auto-generated method stub startAnimation(mAnimation); } }; private View.OnClickListener m_BtnStopClickListener=new View.OnClickListener() { public void onClick(View arg0) { // TODO Auto-generated method stub stopAnimation(mAnimation); } }; protected void startAnimation(final AnimationDrawable animation) { if (animation != null && !animation.isRunning()) { animation.run(); } } protected void stopAnimation(final AnimationDrawable animation) { if (animation != null && animation.isRunning()) animation.stop(); }
这样就可以了`
- android 逐帧动画
- Android逐帧动画
- android逐帧动画
- Android 逐帧动画
- Android 逐帧动画
- Android 逐帧动画
- Android 动画(四)---逐帧动画
- Android布局动画和逐帧动画
- Android 逐帧动画&补间动画
- Android动画基础-逐帧动画
- Android动画2-逐帧动画(FrameAnimation)
- android动画之逐帧动画
- Android动画之逐帧动画
- Android动画——逐帧动画
- Android动画之逐帧动画
- Android动画专题之逐帧动画
- Android动画(一),逐帧动画
- android动画(一)逐帧动画
- @property
- oracle 53个优化规则(2)
- LUA中pairs和ipairs的区别(收藏)
- sql server mdx
- AS2分页索引器
- android 逐帧动画
- smarty配置,安装与示例
- FML!!真是搓了,难怪好朋友说我想出来的都是写蛋疼的玩意儿,唉~
- oracle sql 技巧
- SQLServerAgent 服务无法启动问题
- 各种绳子打结方法
- TCC8900 调试(四) --LCD
- PowerDesigner生成数据库建表SQL脚本时去双引号
- SQLServer无法判断空格数量