欢迎界面淡入淡出效果
welcome布局
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/start"
android:orientation="vertical"
android:scaleType="fitXY" >
</ImageView>welcome.java
welcomeImg = (ImageView) findViewById(R.id.logo);
AlphaAnimation animail = new AlphaAnimation(0.1f, 1.0f);
animail.setDuration(3000);
welcomeImg.startAnimation(animail);
animail.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
startActivity(new Intent(Welcome.this, MainActivity.class));
finish();
}
});
本文介绍了一种在Android应用中实现欢迎界面淡入淡出效果的方法。通过使用AlphaAnimation来改变ImageView的透明度,使应用启动时的logo图片能够平滑地从半透明变为完全可见,并在动画结束后跳转到主活动。
5346

被折叠的 条评论
为什么被折叠?



