1. 程式人生 > >Android核心技術-day03-04-幀動畫

Android核心技術-day03-04-幀動畫

package com.gaozewen.frameanimation;

import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;

public class MainActivity extends AppCompatActivity {

    private ImageView mIv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mIv = (ImageView) findViewById(R.id.iv);
        mIv.setBackgroundResource(R.drawable.girl_anim);
        AnimationDrawable anim = (AnimationDrawable) mIv.getBackground();
        anim.start();
    }
}