Search code examples
androidioscodenameonestatusbar

Codename one Dark style status bar on App


I'm working on an app in Codename one with a dark colored title bar (and status background color).
Is it possible to use the change the status bar theme on iOS and Android to use light icons etc?

Looks like this is how you do it on iOS;
Change status bar text color to light in iOS 9 with Objective C

and this is how it's done on Android; Android M Light and Dark status bar programmatically - how to make it dark again?

Is it possible to achieve these in Codename one without downloading the source and building locally?


Solution

  • Check out the colors.xml file mentioned here: https://www.codenameone.com/manual/advanced-topics.html

    Just place it in the native/android folder to define the colors of your app for the status bar:

    <resources>
        <color name="colorPrimary">#ff00ff00</color>
        <color name="colorPrimaryDark">#80ff0000</color>
        <color name="colorAccent">#800000ff</color>
    </resources>
    

    For iOS the build hint: ios.statusBarFG=UIStatusBarStyleLightContent should work.