Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public final class SystemBars

  1. Object
  2. SystemBars

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);

Fields

public static final int STYLE_DEFAULT = 0Let the platform choose the icon style from the theme.
public static final int STYLE_LIGHT_CONTENT = 1Light icons, for a dark bar background.
public static final int STYLE_DARK_CONTENT = 2Dark icons, for a light bar background.

Methods

public static boolean isSupported()True when the port styles the system bars.
public static void setStatusBarStyle(int style)Sets the status bar icon style.
public static void setStatusBarColor(int argb)Sets the status bar background color.
public static void setNavigationBarColor(int argb, boolean lightIcons)Sets the navigation bar background color and icon style.
public static void setStatusBarHidden(boolean hidden)Hides or shows the status bar.
public static void setEdgeToEdge(boolean edgeToEdge)Lets the application draw behind the status and navigation bars.

Inherited methods

Field details

STYLE_DEFAULT

public static final int STYLE_DEFAULT = 0
Let the platform choose the icon style from the theme.

STYLE_LIGHT_CONTENT

public static final int STYLE_LIGHT_CONTENT = 1
Light icons, for a dark bar background.

STYLE_DARK_CONTENT

public static final int STYLE_DARK_CONTENT = 2
Dark icons, for a light bar background.

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 int
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 int
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 int
the color, with alpha in the high byte
lightIcons boolean
true for light icons on a dark bar

setStatusBarHidden

public static void setStatusBarHidden(boolean hidden)
Hides or shows the status bar.

Parameters

hidden boolean
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 boolean
true to draw behind the bars