Skip to content

Status Bar Background #95

Description

@archieherbias

Is it possible to change the status bar color of the splashscreen?

Activity

  1. lone-cloud commented on Sep 27, 2017

    @lone-cloud

    The easiest way that I found is to monkey patch your status bar color like <item name="colorPrimaryDark">#400101</item> into res/values/styles.xml's SplashScreen_SplashTheme from this library.

  2. Noor0 commented on Jun 28, 2018

    @Noor0

    status bar is black and the icons are also black this issue still persists

  3. AE0011 commented on Jul 24, 2018

    @AE0011

    this version works right:
    "react-native-splash-screen": "^3.0.6"

    also add
    <color name="primary_dark">#2b8ce5</color> this in colors.xml

  4. chico commented on Aug 20, 2018

    @chico

    It works as long as you also change your show method to include your custom style.

    From the README:

    If you want to customize the color of the status bar when the splash screen is displayed:

    Create android/app/src/main/res/values/colors.xml and add

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <color name="status_bar_color"><!-- Colour of your status bar here --></color>
    </resources>

    Create a style definition for this in android/app/src/main/res/values/styles.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <style name="SplashScreenTheme" parent="SplashScreen_SplashTheme">
            <item name="colorPrimaryDark">@color/status_bar_color</item>
        </style>
    </resources>

    Change your show method to include your custom style:

    SplashScreen.show(this, R.style.SplashScreenTheme);
  5. rizkiandrianto commented on Jan 8, 2019

    @rizkiandrianto

    It works as long as you also change your show method to include your custom style.

    From the README:

    If you want to customize the color of the status bar when the splash screen is displayed:

    Create android/app/src/main/res/values/colors.xml and add

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <color name="status_bar_color"><!-- Colour of your status bar here --></color>
    </resources>
    

    Create a style definition for this in android/app/src/main/res/values/styles.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <style name="SplashScreenTheme" parent="SplashScreen_SplashTheme">
            <item name="colorPrimaryDark">@color/status_bar_color</item>
        </style>
    </resources>
    

    Change your show method to include your custom style:

    SplashScreen.show(this, R.style.SplashScreenTheme);

    Hey @chico I got this error if I change my show method like this

    image

  6. Noor0 commented on Jan 10, 2019

    @Noor0

    @rizkiandrianto the symbol after the R.style.<THEME_NAME> should match the name of the theme inside styles.xml

    in my case the name of the theme was SplashTheme

    <resources>
        <!-- Base application theme. -->
        <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
            <!-- 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/splash_background</item>
        </style>
    </resources>
    

    so I'm passing R.style.SplashTheme to my SplashScreen.show()

    SplashScreen.show(this, R.style.SplashTheme);
    
  7. OmarBasem commented on Jul 26, 2019

    @OmarBasem

    For some reason addid SplashScreen.show(this, R.style.SplashTheme); causes white screen flash between splash screen and app mounting, any one facing the same issue or know a fix?

  8. kg-currenxie commented on Aug 7, 2019

    @kg-currenxie

    @RAMON90 i fixed the white screen with

        <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
            <item name="android:statusBarColor">@color/bg</item>
            <item name="android:windowIsTranslucent">true</item> <--------- add this
        </style>
    
  9. parth-koshta commented on Oct 10, 2020

    @parth-koshta

    @RAMON90 i fixed the white screen with

        <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
            <item name="android:statusBarColor">@color/bg</item>
            <item name="android:windowIsTranslucent">true</item> <--------- add this
        </style>
    

    This didn't resolve white screen flash between splash screen and app mounting

  10. parth-koshta commented on Oct 10, 2020

    @parth-koshta

    For some reason addid SplashScreen.show(this, R.style.SplashTheme); causes white screen flash between splash screen and app mounting, any one facing the same issue or know a fix?

    were you able to solve this?

  11. Revolt9k commented on Jun 2, 2022

    @Revolt9k

    If none of this methods allow you to trick conversion error, add true as a third arg of show method like this
    SplashScreen.show(this, R.style.SplashTheme, true);
    Change it to false to disable fullscreen

  12. JJalit commented on Dec 10, 2022

    @JJalit

    I fixed this problem
    I just add true
    SplashScreen.show(this, true);

  13. mathieumousnier commented on May 5, 2023

    @mathieumousnier

    Something might have changed in last versions of android.

    This gives me an error telling that the second argument should be a boolean:
    SplashScreen.show(this, R.style.SplashTheme);

    And this makes the statusBar and the navigationBar with the background color:
    SplashScreen.show(this, true);

  14. Malik-Usman17 commented on Jun 13, 2023

    @Malik-Usman17

    Thanks for the solution, just a little change what I did is to add a third argument true (boolean value) in SplashScreen.show method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions