我想在Splash画面之后出现Layout“authentification”,在我的应用程序中默认出现请帮助我!!!!! pleaaase我需要帮助
public class Splash extends Activity {
LinearLayout ln;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splashh);
ln = (LinearLayout) findViewById(R.id.LinLaySpalScrenLogin);
final ImageView iv = (ImageView) findViewById(R.id.imageView);
final Animation an = AnimationUtils.loadAnimation(getBaseContext(),R.anim.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();
ln.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
}
答案 0 :(得分:0)
ln.setVisibility(View.VISIBLE);
之后您有finish();
。尝试更改为: -
ln.setVisibility(View.VISIBLE);
finish();
然而,这可能不会起作用,因为只要使布局可见即可。活动将结束。您可能希望在启动完成后在另一个活动中显示身份验证。
答案 1 :(得分:0)
您可以在包含启动画面的LinearLayout xml文件中设置android:visibility="gone"
,然后在完成动画后调用yourlayout.setVisibility(View.VISIBLE);
。
您的动画也会在动画结束后立即结束,因为您在finish()
之前调用ln.setVisibility(View.VISIBLE);
尝试删除finish()
并仅在某些事件(例如按钮点击或类似事件)上调用它/ p>