When I start my Android App it shows me a White screen for 1 or 2 seconds. This screen often show before app start How can I remove this starting White screen from my application?
- 5 years ago
Add this item to Your default AppTheme Style
<item name="android:windowDisablePreview">true</item>
Your Default base Style Will something like
<!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> ... <item name="android:windowDisablePreview">true</item> </style>
But I suggest you don't disable windowDisablePreview because it will disable your animations.
instead of above way you can change that white screen to your Application color theme by using this Style
<style name="StartUpTheme" parent="@android:style/Theme.Light.NoTitleBar.Fullscreen"> <item name="android:windowBackground">@color/
colorPrimary</item> </style>
and use it in your Manifest file like
<application
...
<activity
android:name="com.google.androids.MainActivity"
android:label="@string/app_name"
android:theme="@style/StartUpTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
- 5 years ago
Add this item to Your default AppTheme Style
<item name="android:windowDisablePreview">true</item>
Your Default base Style Will something like
<!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> ... <item name="android:windowDisablePreview">true</item> </style>
But I suggest you don't disable windowDisablePreview because it will disable your animations.
instead of above way you can change that white screen to your Application color theme by using this Style
<style name="StartUpTheme" parent="@android:style/Theme.Light.NoTitleBar.Fullscreen"> <item name="android:windowBackground">@color/
colorPrimary</item> </style>
and use it in your Manifest file like
<application
...
<activity
android:name="com.google.androids.MainActivity"
android:label="@string/app_name"
android:theme="@style/StartUpTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Hot Questions