Reputation: 531
When the splashscreen finishes loading, the app sometimes go blank and I have to press the home key and open the app again before it works. This happens frequently enough to make it very annoying. Please how can I get rid of it completely. Have seen other solutions but they didn't work for me. Am building for Android.
Upvotes: 2
Views: 200
Reputation: 126563
To avoid the blank screen you can use a theme related to your Activity, for example :
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/fondo_splash</item>
</style>
into the android:windowBackground
property you must define a backgroud that will be present all the time, for example an image (stored into @drawable/
)
<item name="android:windowBackground">@drawable/bakg_image_splash</item>
or a color (@color/
):
<item name="android:windowBackground">@color/background_splash</item>
Inside our AndroidManifest.xml
we can define the theme for our application :
<application
android:theme="@style/SplashTheme">
o an specific Activity:
<activity android:name=".SplashScreenActivity"
android:theme="@style/SplashTheme" >
With this we can assure to have a background (drawable or color), and avoid the blank screen.
Upvotes: 1