public class LoginActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); final View view = View.inflate(this,R.layout.login,null); setContentView(view); //渐变启动屏 AlphaAnimation aa = new AlphaAnimation(0.3f,0.9f); aa.setDuration(2000); view.startAnimation(aa); aa.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { redirectTo(); } @Override public void onAnimationRepeat(Animation animation) { } }); } //跳转到主页面 private void redirectTo() { Intent intent = new Intent(LoginActivity.this,MainActivity.class); startActivity(intent); finish(); }
android实现动画自动播放的渐变欢迎页面
最新推荐文章于 2023-04-22 11:50:04 发布