【问题标题】:Text appear after Splash screen启动画面后出现文字
【发布时间】:2016-08-06 19:32:56
【问题描述】:

我希望布局“身份验证”出现在启动画面之后,在我的应用程序中它默认出现,请有人帮助我!!!!!! 请问我需要帮助

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) {

                }
            });
        }
    }

【问题讨论】:

  • 什么意思??你不能先得到启动画面?
  • 你为什么要完成当前的活动?

标签: java android xml eclipse android-studio


【解决方案1】:

您可以在包含启动画面的 LinearLayout xml 文件中设置 android:visibility="gone",然后在完成动画后调用 yourlayout.setVisibility(View.VISIBLE);。 此外,您的活动将在动画完成后立即结束,因为您在 ln.setVisibility(View.VISIBLE); 之前调用了 finish() 尝试删除 finish() 并仅在某些事件(例如按钮单击或类似事件)时调用它

【讨论】:

  • 非常感谢 :) 阿米尔
【解决方案2】:

finish(); 后面有 ln.setVisibility(View.VISIBLE);。尝试更改为:-

    ln.setVisibility(View.VISIBLE);
    finish();

但是,这可能不起作用,因为一旦使布局可见。活动就结束了。您可能希望在启动完成后在另一个活动中显示身份验证。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-02
    • 1970-01-01
    • 2015-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多