【问题标题】:white background for few seconds before splash screen android在启动屏幕android之前几秒钟的白色背景
【发布时间】:2016-09-30 14:36:38
【问题描述】:

我在启动应用程序时遇到问题。白色背景在第一次启动时显示几秒钟,然后在第二次启动时有时不会出现。

我在我的 AppTheme 中使用了这个

<item name="android:windowNoTitle">true</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowBackground">@drawable/my_app_background</item>

我成功了,但它在应用程序内也显示了my_app_background 图像,而不是white background

我当前的应用主题

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

    </style>

启动画面

public class SplashScreen extends AppCompatActivity{

    // Splash screen timer
    public static int SCREEN_TIMEOUT=3000;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash_screen);

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {

                Intent intent = new Intent(SplashScreen.this, MainActivity.class);
                startActivity(intent);
                finish();

                Toast.makeText(SplashScreen.this,"Message",Toast.LENGTH_SHORT).show();
            }
        }, SCREEN_TIMEOUT);

    }
}

【问题讨论】:

  • 请您粘贴您的 Splash Activity 的代码吗?

标签: android themes


【解决方案1】:

把它放在你的清单文件中:

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

【讨论】:

    【解决方案2】:
      <item name="android:windowDisablePreview">true</item>
    

    ** 将此行放在您的样式中,它可以防止在启动前打开白屏

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-28
      • 1970-01-01
      • 1970-01-01
      • 2018-03-18
      • 2019-10-03
      • 2014-06-23
      相关资源
      最近更新 更多