How to change the status bar color for different Android and iOS platforms?

 Before my app was with android:targetSdkVersion="14" but i decide to make it a little more modern and update it to android:targetSdkVersion="22". However now i have a little problem, the color of the top status bar during the launch phase is now gray (like on the picture) and i would prefer to have it black (like it's was before).


Any idea what i need to do to have my status bar black again during the launch phase ?


NOTE

I would like to change the color of the statusbar via the styles.xml. actually i try to add


@android:color/black

or

@android:color/black

didn't help! this question is not a duplicate of other because i can set the StatusBar color to be black without any problem after the app is launched or fully loaded. I need to setup the black background for the statusbar during the launching phase, i mean when user click on the icon of the app their is something like a launch screen (with a define to be black via


@android:color/black) but the statusbar color of this launch sreen is gray (only if android:targetSdkVersion="22")
Answered by Chloe Burgess

You can easily change your background colors according to your favorite color, however, before looking into the solution, it is necessary to remind you that the process of setting or changing the background black color during the launching phase can vary according to the platform. It means there will be different processes for Android and different processes for iOS

For Android:-

You can change the status bar color in Android by setting the 'Android: statusBarColor' attribute in your theme of the app. This can be done in your 'style. XML'.

Here is one example provided in 'styles.xml':-

    @color/your_color

For iOS:-

In iOS, you can change or set the bar color of status by using the 'preferredStatusBarStyle' property. You can get it on your view controller. You will need to make a custom navigation bar. You can also use the 'UINavigationBar' appearance to change the color of your bar status. Here is an example for iOS users to change the color in Swift:-

override var preferredStatusBarStyle: UIStatusBarStyle {
    return .lightContent // Change it according to your design
}


Your Answer

Interviews

Parent Categories