Skip to main content

AndroidDisplay

Kindclass
Packageandroid.platform
Full nameandroid.platform.AndroidDisplay
Sourcesource/android/platform/AndroidDisplay.hx

Native display information: physical resolution, density/DPI, orientation, refresh rate and display cutout insets, plus immersive (edge-to-edge) fullscreen handling.

Public fields​

NameTypeStaticDefaultNotes
ROTATION_0Intyes0final · android.view.Surface rotation constants.
ROTATION_90Intyes1final
ROTATION_180Intyes2final
ROTATION_270Intyes3final
onChangedFlxSignalyes—property (get, never) · Fired when the display configuration changes (rotation, mode, ...).

Public methods​

getInfo​

static function getInfo():Null<DisplayInfo>

Queries the display for full information. On non-Android targets returns null; callers should fall back to FlxG.stage dimensions.

View source

getCutoutInsets​

static function getCutoutInsets():CutoutInsets

Cutout safe insets as {left, top, right, bottom} pixels (all 0 when none).

View source

getRefreshRate​

static function getRefreshRate():Float

Active display refresh rate (falls back to 60 when unknown).

View source

setImmersive​

static function setImmersive(mode:String = "full"):Void

Applies an immersive mode: "full" - hide status + navigation bars, re-show transiently on swipe "lean" - hide bars, any swipe re-shows them "off" - restore all system bars

ParameterTypeDefault
mode (optional)String"full"

View source

setCutoutMode​

static function setCutoutMode(mode:String = "shortEdges"):Void

Display cutout behavior: "default", "shortEdges", "always" or "never". Controls how content lays out around notches and hole-punch cameras.

ParameterTypeDefault
mode (optional)String"shortEdges"

View source

setPreferredRefreshRate​

static function setPreferredRefreshRate(rate:Float):Void

Best-effort request for a preferred refresh rate (API 23+). Pass 0 to clear the preference.

ParameterTypeDefault
rateFloat—

View source

watchDisplay​

static function watchDisplay():Void

Starts receiving display change events (onChanged).

View source

Internals​

Private / internal members
FieldTypeStatic
_getDisplayInfoDynamicyes
_getCutoutInsetsDynamicyes
_setImmersiveDynamicyes
_setCutoutModeDynamicyes
_setPreferredRefreshRateDynamicyes
_registerDisplayListenerDynamicyes
Method
static inline function get_onChanged():FlxSignal
static function getDisplayInfo_jni():String
static function getCutoutInsets_jni():String
static function setImmersive_jni(mode:String):Void
static function setCutoutMode_jni(mode:String):Void
static function setPreferredRefreshRate_jni(rate:Float):Void
static function registerDisplayListener_jni():Void