-
public final class WindowCompat
Helper for accessing features in Window.
-
-
Field Summary
Fields Modifier and Type Field Description public final static int
FEATURE_ACTION_BAR
public final static int
FEATURE_ACTION_BAR_OVERLAY
public final static int
FEATURE_ACTION_MODE_OVERLAY
-
Method Summary
Modifier and Type Method Description static <T extends View> T
requireViewById(@NonNull() Window window, @IdRes() int id)
Finds a view that was identified by the {@code android:id}
XML attributethat was processed in onCreate, or throws anIllegalArgumentException if the ID is invalid, or there is no matching view in the hierarchy.static void
setDecorFitsSystemWindows(@NonNull() Window window, boolean decorFitsSystemWindows)
Sets whether the decor view should fit root-level content views for WindowInsetsCompat. static WindowInsetsControllerCompat
getInsetsController(@NonNull() Window window, @NonNull() View view)
Retrieves the single WindowInsetsController of the window this view is attached to. -
-
Method Detail
-
requireViewById
@NonNull() static <T extends View> T requireViewById(@NonNull() Window window, @IdRes() int id)
Finds a view that was identified by the
{@code android:id}
XML attributethat was processed in onCreate, or throws anIllegalArgumentException if the ID is invalid, or there is no matching view in the hierarchy.Note: In most cases -- depending on compiler support --the resulting view is automatically cast to the target class type. Ifthe target class type is unconstrained, an explicit cast may benecessary.
- Parameters:
id
- the ID to search for
-
setDecorFitsSystemWindows
static void setDecorFitsSystemWindows(@NonNull() Window window, boolean decorFitsSystemWindows)
Sets whether the decor view should fit root-level content views for WindowInsetsCompat.
If set to
{@code false}
, the framework will not fit the content view to the insets and willjust pass through the WindowInsetsCompat to the content view.Please note: using the setSystemUiVisibility API in your app canconflict with this method. Please discontinue use of setSystemUiVisibility.
- Parameters:
window
- The current window.decorFitsSystemWindows
- Whether the decor view should fit root-level content views forinsets.
-
getInsetsController
@Nullable() static WindowInsetsControllerCompat getInsetsController(@NonNull() Window window, @NonNull() View view)
Retrieves the single WindowInsetsController of the window this view is attached to.
-
-
-
-