Class SystemBars

java.lang.Object
com.codename1.ui.SystemBars

public final class SystemBars extends Object

Styles the system bars: the status bar's icon style, color and visibility, the Android navigation bar's color, and drawing behind both bars (edge to edge).

Each call is a request. A platform that cannot honor one ignores it: iOS has no status bar color of its own (the form's title area shows through) and no navigation bar, and the simulator ignores all of them. #isSupported() tells whether the port styles the bars at all.

SystemBars.setStatusBarStyle(SystemBars.STYLE_LIGHT_CONTENT);
SystemBars.setStatusBarColor(0xff1a237e);
SystemBars.setNavigationBarColor(0xff1a237e, true);
  • Field Details

    • STYLE_DEFAULT

      public static final int STYLE_DEFAULT
      Let the platform choose the icon style from the theme.
      See Also:
    • STYLE_LIGHT_CONTENT

      public static final int STYLE_LIGHT_CONTENT
      Light icons, for a dark bar background.
      See Also:
    • STYLE_DARK_CONTENT

      public static final int STYLE_DARK_CONTENT
      Dark icons, for a light bar background.
      See Also:
  • Method Details

    • isSupported

      public static boolean isSupported()

      True when the port styles the system bars.

      Returns

      true when the calls in this class have an effect

    • setStatusBarStyle

      public static void setStatusBarStyle(int style)

      Sets the status bar icon style.

      Parameters
      • style: STYLE_DEFAULT, STYLE_LIGHT_CONTENT or STYLE_DARK_CONTENT
    • setStatusBarColor

      public static void setStatusBarColor(int argb)

      Sets the status bar background color. Android only.

      Parameters
      • argb: the color, with alpha in the high byte
    • setNavigationBarColor

      public static void setNavigationBarColor(int argb, boolean lightIcons)

      Sets the navigation bar background color and icon style. Android only.

      Parameters
      • argb: the color, with alpha in the high byte
      • lightIcons: true for light icons on a dark bar
    • setStatusBarHidden

      public static void setStatusBarHidden(boolean hidden)

      Hides or shows the status bar.

      Parameters
      • hidden: true to hide it
    • setEdgeToEdge

      public static void setEdgeToEdge(boolean edgeToEdge)

      Lets the application draw behind the status and navigation bars. Use the safe area insets to keep content clear of them.

      Parameters
      • edgeToEdge: true to draw behind the bars