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>

  • 相关阅读:
    扑克牌顺子
    多任务Multitask Learning
    智能指针
    左旋转字符串
    和为s的两个数字
    07.极简主义读后感
    06.极简主义——汇流(笔记)
    05.极简主义——奉献(笔记)
    04.极简主义——热情(笔记)
    03.极简主义——人际关系(笔记)
  • 原文地址:https://www.cnblogs.com/itfenqing/p/4429508.html
Copyright © 2011-2022 走看看