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>

  • 相关阅读:
    alertify、js、css 使用简介
    html 跳转页面,同时跳转到一个指定的位置
    java 解析 json 遍历未知key
    JSON 字符串 与 java 对象的转换
    iOS安全系列之 HTTPS 进阶
    iOS安全系列之 HTTPS
    iOS-socket
    他人整理开源组件列表
    iOS Layout机制相关方法
    在写一个iOS应用之前必须做的7件事(附相关资源)
  • 原文地址:https://www.cnblogs.com/itfenqing/p/4429508.html
Copyright © 2011-2022 走看看