Android:启动动画
package com.example.administrator.myapplication;
import android.support.v7.app.appcompatactivity;
import android.os.bundle;
import android.app.activity;
import android.content.intent;
import android.os.bundle;
import android.view.animation.alphaanimation;
import android.view.animation.animation;
import android.view.animation.animation.animationlistener;
import android.widget.imageview;
public class mainactivity extends appcompatactivity {
imageview welcomeimg= null;
@override
protected void oncreate(bundlesavedinstancestate) {
super.oncreate(savedinstancestate);
setcontentview(r.layout.activity_main);
welcomeimg= (imageview) this.findviewbyid(r.id.welcome_img);
alphaanimation anima = new alphaanimation(0.3f,1.0f);
anima.setduration(2000);// 设置动画显示时间
welcomeimg.startanimation(anima);
anima.setanimationlistener(new animationimpl());
}
private class animationimplimplements animationlistener
{
@override
public void onanimationstart(animationanimation) {
welcomeimg.setbackgroundresource(r.drawable.welcome);
}
@override
public void onanimationend(animationanimation) {
skip(); //动画结束后跳转到别的页面
}
@override
public void onanimationrepeat(animationanimation) {
}
private voidskip() {
intent intent = new intent();
intent.setclass(mainactivity.this, secondactivity.class);
startactivity(intent);
}
}
}