1

I have tried implementing a splash screen in order to remove that white startup screen however, I still find its there. How can I go about changing that white start up screen with a different colour or have my splash screen to go over that white start up screen?

AndroidManifest.xml

  <activity
    android:name=".SplashActivity"
    android:theme="@style/SplashTheme"
    android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>

Values/styles.xml

<resources>
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:statusBarColor">@color/blue</item>
    <item name="android:windowDisablePreview">true</item>
        <!-- Customize your theme here. -->
    </style>
    <style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowBackground">@drawable/background_splash</item>
    <item name="android:statusBarColor">@color/blue</item>
    <item name="android:windowDisablePreview">true</item>

    </style>
</resources>

values/colors/.xml

   <?xml version="1.0" encoding="utf-8"?>
    <resources>
         <color name="status_bar_color">#233240</color>
          <color name="blue">#233240</color>
          <color name="primary_dark">#233240</color>

    </resources>

layout/SplashScreen.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/blue"
>
</LinearLayout>

MainActivity.java

public class MainActivity extends ReactActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        SplashScreen.show(this, true);
        super.onCreate(savedInstanceState);

    }

SplashActivity.java

public class SplashActivity extends  AppCompatActivity{


    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
        finish();
    }

}
Arun J
  • 687
  • 4
  • 14
  • 27
Chris Henry
  • 199
  • 1
  • 1
  • 13
  • 1
    Possible duplicate of [Android - Prevent white screen at startup](https://stackoverflow.com/questions/37437037/android-prevent-white-screen-at-startup) – vivek verma Apr 02 '18 at 00:27

0 Answers0