新建动画类xml文件
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
set
xmlns:android
=
"http://schemas.android.com/apk/res/android"
>
<
alpha
android:duration
=
"2000"
android:fromAlpha
=
"0.3"
android:toAlpha
=
"1.0"
/>
<
translate
android:duration
=
"1000"
android:fromYDelta
=
"80%"
/>
</
set
>
在Activity中载入后启动动画,可添加动画监听器,监听当动画结束后跳转到主界面。
Animation scale = AnimationUtils. loadAnimation(
this
, R.anim.
scale_anim
);
welcomeImg
.startAnimation(scale);
scale.setAnimationListener(
new
AnimationListener() {
@Override
public
void
onAnimationStart(Animation animation) {
}
@Override
public
void
onAnimationRepeat(Animation animation) {
}
@Override
public
void
onAnimationEnd(Animation animation) {
startActivity(
new
Intent(WelcomeActivity.
this
,LoginActivity.
class
));
finish();
}
});