gpt4 book ai didi

java - 启动画面取决于点击继续

转载 作者:行者123 更新时间:2023-12-01 10:44:49 25 4
gpt4 key购买 nike

目前,我的启动屏幕直接链接到我的 mainActivity。当旋转持续时间结束时,启动屏幕结束。 android:duration="8000"

然后我在最后有一个警报对话框。

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);


final ImageView iv = (ImageView) findViewById(R.id.imageView);
final Animation an = AnimationUtils.loadAnimation(getBaseContext(), R.animator.rotate);
final Animation an2 = AnimationUtils.loadAnimation(getBaseContext(), R.anim.abc_fade_out);

iv.startAnimation(an);
an.setAnimationListener(new Animation.AnimationListener() {


@Override
public void onAnimationStart(Animation animation) {

}

@Override
public void onAnimationEnd(Animation animation) {
iv.startAnimation(an2);
finish();
Intent i = new Intent(getBaseContext(), MainActivity.class);
startActivity(i);
}

@Override
public void onAnimationRepeat(Animation animation) {

}
});
new AlertDialog.Builder(this).setTitle("Promo Code").setMessage("Type in 'VC2001' for a 10% discount. Only applicable for VC-20U").setNeutralButton("Close", null).show();

}
`

那么,有什么办法可以在我点击关闭后结束启动屏幕吗?

这听起来可能真的很愚蠢,因为我对 Android 很陌生

最佳答案

AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(yoursplashscreen.this);

dialogBuilder.setTitle("Promo Code");
dialogBuilder.setMessage("Type in 'VC2001' for a 10% discount. Only applicable for VC-20U");


dialogBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
// finish your splash screen here and set intent to your new activity
finish();
Intent i = new Intent(getBaseContext(), MainActivity.class);
startActivity(i);
}
});
AlertDialog alertDialog = dialogBuilder.create();
alertDialog.show();

关于java - 启动画面取决于点击继续,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34249654/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com