Type
class Type
| kotlin.Any | |
| ↳ | android.view.WindowInsets.Type |
Class that defines different types of sources causing window insets.
Each type is represented by an integer bit flag. Types can be combined using bitwise OR (e.g. Type.statusBars() | Type.navigationBars()) and passed to query methods such as WindowInsets.getInsets(int), WindowInsets.getInsetsIgnoringVisibility(int), WindowInsets.isVisible(int), WindowInsets.getBoundingRects(int), or to WindowInsetsController methods to request showing or hiding system elements.
Summary
| Public methods | |
|---|---|
| static Int |
Returns an insets type representing the window of a caption bar. |
| static Int |
Returns an insets type representing the area that used by |
| static Int |
ime()Returns an insets type representing the window of an on-screen Input Method Editor (IME). |
| static Int |
Returns an insets type representing the mandatory system gesture insets. |
| static Int |
Returns an insets type representing any system bars for navigation. |
| static Int |
Returns an insets type representing any system bars displaying device status. |
| static Int |
Returns an aggregate insets type representing all system bars and persistent system decorations. |
| static Int |
Returns an insets type representing the system gesture insets. |
| static Int |
Returns an insets type representing persistent, non-dismissible system overlays. |
| static Int |
Returns an insets type representing the tappable element insets. |
Public methods
captionBar
static fun captionBar(): Int
Returns an insets type representing the window of a caption bar.
A caption bar represents the window header / title bar provided by the system for window decorations and management controls (such as minimize, maximize/restore, close, and title text).
Applications targeting desktop environments can use this inset alongside WindowInsets.getBoundingRects(int) to draw custom header content without colliding with system window control buttons.
| Return | |
|---|---|
Int |
An insets type representing the window of a caption bar. Value is either 0 or a combination of the following:
|
displayCutout
static fun displayCutout(): Int
Returns an insets type representing the area that used by DisplayCutout.
This is equivalent to the safe insets on getDisplayCutout().
Note: During dispatch to View.onApplyWindowInsets, if the window is using the default WindowManager.LayoutParams.layoutInDisplayCutoutMode, getDisplayCutout() will return null even if the window overlaps a display cutout area, in which case the displayCutout() inset will still report the accurate value.
| Return | |
|---|---|
Int |
Value is either 0 or a combination of the following:
|
ime
static fun ime(): Int
Returns an insets type representing the window of an on-screen Input Method Editor (IME).
The IME inset represents the area occupied by the on-screen software keyboard when requested by an active text input field.
Floating & Undocked IMEs: When the on-screen keyboard is configured in floating or undocked mode (such as on tablets, foldables, desktop environments, or when selected by the user), it floats above window content without docking to a screen edge. In floating mode, the keyboard does not produce window insets, and querying WindowInsets.getInsets(int) with ime() will return Insets.NONE (even while the keyboard is visible). Applications should note that floating keyboards may occlude underlying UI elements without causing the view hierarchy to inset or resize.
Note: WindowInsets.getInsetsIgnoringVisibility(int) cannot be queried for ime() because the height of the IME is determined dynamically by the focused view's EditorInfo and the IME state; attempting to do so will throw an IllegalArgumentException.
| Return | |
|---|---|
Int |
Value is either 0 or a combination of the following:
|
mandatorySystemGestures
static fun mandatorySystemGestures(): Int
Returns an insets type representing the mandatory system gesture insets.
Mandatory system gesture insets represent the areas of a window where system gestures are critical and cannot be overridden or opted out of by the application using View.setSystemGestureExclusionRects(List).
| Return | |
|---|---|
Int |
Value is either 0 or a combination of the following:
|
navigationBars
static fun navigationBars(): Int
Returns an insets type representing any system bars for navigation.
Navigation bars provide affordances for the user to navigate to other screens or activities.
These insets can be controlled dynamically via WindowInsetsController APIs.
| Return | |
|---|---|
Int |
Value is either 0 or a combination of the following:
|
statusBars
static fun statusBars(): Int
Returns an insets type representing any system bars displaying device status.
Status bars typically display persistent indicators such as the clock, battery level, signal strength, and notification icons.
This type of insets can be controlled dynamically via WindowInsetsController APIs.
| Return | |
|---|---|
Int |
Value is either 0 or a combination of the following:
|
systemBars
static fun systemBars(): Int
Returns an aggregate insets type representing all system bars and persistent system decorations.
Includes statusBars(), navigationBars(), captionBar(), and systemOverlays(), but excludes ime() and displayCutout().
| Return | |
|---|---|
Int |
Value is either 0 or a combination of the following:
|
systemGestures
static fun systemGestures(): Int
Returns an insets type representing the system gesture insets.
The system gesture insets represent the area of a window where system gestures (such as the edge-swipe back gesture or bottom-swipe home gesture) have priority and may consume touch input before it reaches the window.
Simple taps are guaranteed to reach the window even within the system gesture insets, as long as they are outside the areas reported by system window insets.
Apps can declare priority over non-mandatory system gestures in specific sub-regions using View.setSystemGestureExclusionRects(List).
| Return | |
|---|---|
Int |
Value is either 0 or a combination of the following:
|
systemOverlays
static fun systemOverlays(): Int
Returns an insets type representing persistent, non-dismissible system overlays.
System overlays represent insets caused by system-provided UI elements overlaid on the screen or window that cannot be hidden or controlled by client WindowInsetsController requests.
For compatibility reasons, this type is included in systemBars(), ensuring views that fit systemBars() automatically accommodate system overlays.
| Return | |
|---|---|
Int |
Value is either 0 or a combination of the following:
|
See Also
tappableElement
static fun tappableElement(): Int
Returns an insets type representing the tappable element insets.
Apps should inset its tappable elements by at least this amount to ensure they can be tapped.
This inset is always at most the size of systemBars. It may be smaller than the systemBars inset if the system bars let through clean taps but not other kinds of gestures.
| Return | |
|---|---|
Int |
Value is either 0 or a combination of the following:
|