Problematic Android Apps – One of the common reasons for this issue is the apps you have installed on your phone. Not every app is fully compatible or bug-free. When you end up installing an app that has issues with it, the app causes your phone to go all white screen.
One of the reliable ways to fix the white screen of death on Android Phones or Tablets is to reboot your phone. First, press down the Power Button and Volume Down together, then tap on reboot. Once your phone reboot, it might result from a virus causing the Phone IOS not to load on time.
you should disable Instant Run android studio Settings. File>Settings>Build,Execution, Deployment>Instant Run unCheck all options shown there. Note: White screen Issue due to Instant Run is only for Debug builds,this Issue will not appear on release builds.
For removing the flutter native splash, you have to run flutter pub run flutter_native_splash:remove command in terminal.
Put this in a custom style and it solves all the problems. Using the hacky translucent fix will make your task bar and nav bar translucent and make the splashscreen or main screen look like spaghetti.
<item name="android:windowDisablePreview">true</item>
Just mention the transparent theme to the starting activity in the AndroidManifest.xml file.
Like:
<activity
android:name="first Activity Name"
android:theme="@android:style/Theme.Translucent.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
and extend that screen with Activity
class in place of AppCompatActivity
.
like :
public class SplashScreenActivity extends Activity{
----YOUR CODE GOES HERE----
}
Like you tube.. initially they show icon screen instead of white screen. And after 2 seconds shows home screen.
first create an XML drawable in res/drawable.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/gray"/>
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/ic_launcher"/>
</item>
</layer-list>
Next, you will set this as your splash activity’s background in the theme. Navigate to your styles.xml file and add a new theme for your splash activity
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/background_splash</item>
</style>
</resources>
In your new SplashTheme, set the window background attribute to your XML drawable. Configure this as your splash activity’s theme in your AndroidManifest.xml:
<activity
android:name=".SplashActivity"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
This link gives what you want. step by step procedure. https://www.bignerdranch.com/blog/splash-screens-the-right-way/
UPDATE:
The layer-list
can be even simpler like this (which also accepts vector drawables for the centered logo, unlike the <bitmap>
tag):
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Background color -->
<item android:drawable="@color/gray"/>
<!-- Logo at the center of the screen -->
<item
android:drawable="@mipmap/ic_launcher"
android:gravity="center"/>
</layer-list>
Make a style in you style.xml as follows :
<style name="Theme.Transparent" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsTranslucent">true</item>
</style>
and use it with your activity in AndroidManifest as:
<activity android:name=".ActivitySplash" android:theme="@style/Theme.Transparent">
You should read this great post by Cyril Mottier: Android App launching made gorgeous
You need to customise your Theme
in style.xml and avoid to customise in your onCreate
as ActionBar.setIcon/setTitle/etc.
See also the Documentation on Performance Tips by Google.
Use Trace View
and Hierarchy Viewer
to see the time to display your Views: Android Performance Optimization / Performance Tuning On Android
Use AsyncTask
to display some views.
This is my AppTheme on an example app:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowIsTranslucent">true</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
As you can see, I have the default colors and then I added the android:windowIsTranslucent
and set it to true
.
As far as I know as an Android Developer, this is the only thing you need to set in order to hide the white screen on the start of the application.
Both properties works use any one of them.
<style name="AppBaseThemeDark" parent="@style/Theme.AppCompat">
<!--your other properties -->
<!--<item name="android:windowDisablePreview">true</item>-->
<item name="android:windowBackground">@null</item>
<!--your other properties -->
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With