zoukankan      html  css  js  c++  java
  • Animation(四)

    三、Frame-byFrame动画

    Activity代码:

    public class AnimationFrameByFrameActivity extends Activity {

        private ImageView img=null;

        private Button btn=null;

        @Override

        public void onCreate(Bundle savedInstanceState) {

            super.onCreate(savedInstanceState);

            setContentView(R.layout.main);

            img=(ImageView)findViewById(R.id.img);

            btn=(Button)findViewById(R.id.btn);

            btn.setOnClickListener(new OnClickListener() {

               

               public void onClick(View v) {

                  //逐帧动画效果

                  // TODO Auto-generated method stub

                  img.setBackgroundResource(R.drawable.animimg);

                  AnimationDrawable anim=(AnimationDrawable)img.getBackground();

                  anim.start();

               }

           });

        }

    }

    Animimg.xml代码:

    <?xmlversion="1.0"encoding="utf-8"?>

    <animation-listxmlns:android="http://schemas.android.com/apk/res/android"

    android:oneshot="false">

    <itemandroid:drawable="@drawable/a"android:duration="500"/>

    <itemandroid:drawable="@drawable/b"android:duration="500"/>

    <itemandroid:drawable="@drawable/c"android:duration="500"/>

    <itemandroid:drawable="@drawable/d"android:duration="500"/>

    </animation-list>

  • 相关阅读:
    用GUI完成了斗地主发牌
    地主发牌
    用三种循环完成了累加
    DataSet、DataTable、DataRow的数据复制方法
    C# Merge into的使用详解
    grid+report 怎么在项目中使用
    SQL Server 2008 R2:error 26 开启远程连接详解
    EF框架的优点是什么?
    Oracle中的case when then else end 应用
    SQL中的case when then else end用法
  • 原文地址:https://www.cnblogs.com/itfenqing/p/4429508.html
Copyright © 2011-2022 走看看