Window.SetStatusBarColor(Color) Method

Definition

Sets the color of the status bar to color.

[Android.Runtime.Register("setStatusBarColor", "(I)V", "GetSetStatusBarColor_IHandler")]
public abstract void SetStatusBarColor (Android.Graphics.Color color);
[<Android.Runtime.Register("setStatusBarColor", "(I)V", "GetSetStatusBarColor_IHandler")>]
abstract member SetStatusBarColor : Android.Graphics.Color -> unit

Parameters

color
Color
Attributes

Remarks

Sets the color of the status bar to color.

For this to take effect, the window must be drawing the system bar backgrounds with android.view.WindowManager.LayoutParams#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS and android.view.WindowManager.LayoutParams#FLAG_TRANSLUCENT_STATUS must not be set.

If color is not opaque, consider setting android.view.View#SYSTEM_UI_FLAG_LAYOUT_STABLE and android.view.View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN.

The transitionName for the view background will be "android:status:background".

If the color is transparent and the window enforces the status bar contrast, the system will determine whether a scrim is necessary and draw one on behalf of the app to ensure that the status bar has enough contrast with the contents of this app, and set an appropriate effective bar background accordingly.

If the app targets android.os.Build.VERSION_CODES#VANILLA_ICE_CREAM VANILLA_ICE_CREAM or above, the color will be transparent and cannot be changed.

This member is deprecated. Draw proper background behind WindowInsets.Type#statusBars()} instead.

Java documentation for android.view.Window.setStatusBarColor(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to