# WindowCompat

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1  
Summary:[Constants](https://developer.android.com/reference/android/support/v4/view/WindowCompat#constants)\|[Methods](https://developer.android.com/reference/android/support/v4/view/WindowCompat#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v4/view/WindowCompat#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v4/view/WindowCompat#)  

# WindowCompat

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public

final

class
WindowCompat
`  
`

extends Object


``


`

|---|--------------------------------------|
| java.lang.Object                        ||
| ↳ | android.support.v4.view.WindowCompat |

<br />

*** ** * ** ***

Helper for accessing features in[Window](https://developer.android.com/reference/android/view/Window.html).

## Summary

|                                                                                                           ### Constants                                                                                                            ||
|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [FEATURE_ACTION_BAR](https://developer.android.com/reference/android/support/v4/view/WindowCompat#FEATURE_ACTION_BAR) Flag for enabling the Action Bar.                                                                     |
| `int` | [FEATURE_ACTION_BAR_OVERLAY](https://developer.android.com/reference/android/support/v4/view/WindowCompat#FEATURE_ACTION_BAR_OVERLAY) Flag for requesting an Action Bar that overlays window content.                       |
| `int` | [FEATURE_ACTION_MODE_OVERLAY](https://developer.android.com/reference/android/support/v4/view/WindowCompat#FEATURE_ACTION_MODE_OVERLAY) Flag for specifying the behavior of action modes when an Action Bar is not present. |

|                                                                                                                                                                                                                                                                                                                         ### Public methods                                                                                                                                                                                                                                                                                                                         ||
|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static <T extends `[View](https://developer.android.com/reference/android/view/View.html)`> T` | ` `[requireViewById](https://developer.android.com/reference/android/support/v4/view/WindowCompat#requireViewById(android.view.Window, int))`(`[Window](https://developer.android.com/reference/android/view/Window.html)` window, int id) ` Finds a view that was identified by the`android:id`XML attribute that was processed in[onCreate(Bundle)](https://developer.android.com/reference/android/app/Activity.html#onCreate(android.os.Bundle)), or throws an IllegalArgumentException if the ID is invalid, or there is no matching view in the hierarchy. |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4/view/WindowCompat#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Constants

### FEATURE_ACTION_BAR

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int FEATURE_ACTION_BAR
```

Flag for enabling the Action Bar. This is enabled by default for some devices. The Action Bar replaces the title bar and provides an alternate location for an on-screen menu button on some devices.

<br />

Constant Value: 8 (0x00000008)  

### FEATURE_ACTION_BAR_OVERLAY

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int FEATURE_ACTION_BAR_OVERLAY
```

Flag for requesting an Action Bar that overlays window content. Normally an Action Bar will sit in the space above window content, but if this feature is requested along with[FEATURE_ACTION_BAR](https://developer.android.com/reference/android/support/v4/view/WindowCompat#FEATURE_ACTION_BAR)it will be layered over the window content itself. This is useful if you would like your app to have more control over how the Action Bar is displayed, such as letting application content scroll beneath an Action Bar with a transparent background or otherwise displaying a transparent/translucent Action Bar over application content.

This mode is especially useful with[View.SYSTEM_UI_FLAG_FULLSCREEN](https://developer.android.com/reference/android/view/View.html#SYSTEM_UI_FLAG_FULLSCREEN), which allows you to seamlessly hide the action bar in conjunction with other screen decorations.

As of[JELLY_BEAN](https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#JELLY_BEAN), when an ActionBar is in this mode it will adjust the insets provided to[View.fitSystemWindows(Rect)](https://developer.android.com/reference/android/view/View.html#fitSystemWindows(android.graphics.Rect))to include the content covered by the action bar, so you can do layout within that space.

<br />

Constant Value: 9 (0x00000009)  

### FEATURE_ACTION_MODE_OVERLAY

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int FEATURE_ACTION_MODE_OVERLAY
```

Flag for specifying the behavior of action modes when an Action Bar is not present. If overlay is enabled, the action mode UI will be allowed to cover existing window content.

<br />

Constant Value: 10 (0x0000000a)

## Public methods

### requireViewById

added in[version 27.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
T requireViewById (Window window, 
                int id)
```

Finds a view that was identified by the`android:id`XML attribute that was processed in[onCreate(Bundle)](https://developer.android.com/reference/android/app/Activity.html#onCreate(android.os.Bundle)), or throws an IllegalArgumentException 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. If the target class type is unconstrained, an explicit cast may be necessary.

<br />

|                  Parameters                  ||
|----------|------------------------------------|
| `window` | `Window` <br />                    |
| `id`     | `int`: the ID to search for <br /> |

|             Returns              ||
|-----|-----------------------------|
| `T` | a view with given ID <br /> |

**See also:**

- [requireViewById(View, int)](https://developer.android.com/reference/android/support/v4/view/ViewCompat#requireViewById(android.view.View, int))
- [findViewById(int)](https://developer.android.com/https://developer.android.com/reference/android/view/Window#findViewById(int))  
-

  ## Annotations

  - [ViewPager.DecorView](https://developer.android.com/reference/android/support/v4/view/ViewPager.DecorView)
-

  ## Interfaces

  - [ActionProvider.VisibilityListener](https://developer.android.com/reference/android/support/v4/view/ActionProvider.VisibilityListener)
  - [AsyncLayoutInflater.OnInflateFinishedListener](https://developer.android.com/reference/android/support/v4/view/AsyncLayoutInflater.OnInflateFinishedListener)
  - [LayoutInflaterFactory](https://developer.android.com/reference/android/support/v4/view/LayoutInflaterFactory)
  - [MenuItemCompat.OnActionExpandListener](https://developer.android.com/reference/android/support/v4/view/MenuItemCompat.OnActionExpandListener)
  - [NestedScrollingChild](https://developer.android.com/reference/android/support/v4/view/NestedScrollingChild)
  - [NestedScrollingChild2](https://developer.android.com/reference/android/support/v4/view/NestedScrollingChild2)
  - [NestedScrollingParent](https://developer.android.com/reference/android/support/v4/view/NestedScrollingParent)
  - [NestedScrollingParent2](https://developer.android.com/reference/android/support/v4/view/NestedScrollingParent2)
  - [OnApplyWindowInsetsListener](https://developer.android.com/reference/android/support/v4/view/OnApplyWindowInsetsListener)
  - [ScrollingView](https://developer.android.com/reference/android/support/v4/view/ScrollingView)
  - [TintableBackgroundView](https://developer.android.com/reference/android/support/v4/view/TintableBackgroundView)
  - [ViewPager.OnAdapterChangeListener](https://developer.android.com/reference/android/support/v4/view/ViewPager.OnAdapterChangeListener)
  - [ViewPager.OnPageChangeListener](https://developer.android.com/reference/android/support/v4/view/ViewPager.OnPageChangeListener)
  - [ViewPager.PageTransformer](https://developer.android.com/reference/android/support/v4/view/ViewPager.PageTransformer)
  - [ViewPropertyAnimatorListener](https://developer.android.com/reference/android/support/v4/view/ViewPropertyAnimatorListener)
  - [ViewPropertyAnimatorUpdateListener](https://developer.android.com/reference/android/support/v4/view/ViewPropertyAnimatorUpdateListener)
-

  ## Classes

  - [AbsSavedState](https://developer.android.com/reference/android/support/v4/view/AbsSavedState)
  - [AccessibilityDelegateCompat](https://developer.android.com/reference/android/support/v4/view/AccessibilityDelegateCompat)
  - [ActionProvider](https://developer.android.com/reference/android/support/v4/view/ActionProvider)
  - [AsyncLayoutInflater](https://developer.android.com/reference/android/support/v4/view/AsyncLayoutInflater)
  - [GestureDetectorCompat](https://developer.android.com/reference/android/support/v4/view/GestureDetectorCompat)
  - [GravityCompat](https://developer.android.com/reference/android/support/v4/view/GravityCompat)
  - [InputDeviceCompat](https://developer.android.com/reference/android/support/v4/view/InputDeviceCompat)
  - [LayoutInflaterCompat](https://developer.android.com/reference/android/support/v4/view/LayoutInflaterCompat)
  - [MarginLayoutParamsCompat](https://developer.android.com/reference/android/support/v4/view/MarginLayoutParamsCompat)
  - [MenuCompat](https://developer.android.com/reference/android/support/v4/view/MenuCompat)
  - [MenuItemCompat](https://developer.android.com/reference/android/support/v4/view/MenuItemCompat)
  - [MotionEventCompat](https://developer.android.com/reference/android/support/v4/view/MotionEventCompat)
  - [NestedScrollingChildHelper](https://developer.android.com/reference/android/support/v4/view/NestedScrollingChildHelper)
  - [NestedScrollingParentHelper](https://developer.android.com/reference/android/support/v4/view/NestedScrollingParentHelper)
  - [PagerAdapter](https://developer.android.com/reference/android/support/v4/view/PagerAdapter)
  - [PagerTabStrip](https://developer.android.com/reference/android/support/v4/view/PagerTabStrip)
  - [PagerTitleStrip](https://developer.android.com/reference/android/support/v4/view/PagerTitleStrip)
  - [PointerIconCompat](https://developer.android.com/reference/android/support/v4/view/PointerIconCompat)
  - [ScaleGestureDetectorCompat](https://developer.android.com/reference/android/support/v4/view/ScaleGestureDetectorCompat)
  - [VelocityTrackerCompat](https://developer.android.com/reference/android/support/v4/view/VelocityTrackerCompat)
  - [ViewCompat](https://developer.android.com/reference/android/support/v4/view/ViewCompat)
  - [ViewConfigurationCompat](https://developer.android.com/reference/android/support/v4/view/ViewConfigurationCompat)
  - [ViewGroupCompat](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat)
  - [ViewPager](https://developer.android.com/reference/android/support/v4/view/ViewPager)
  - [ViewPager.LayoutParams](https://developer.android.com/reference/android/support/v4/view/ViewPager.LayoutParams)
  - [ViewPager.SavedState](https://developer.android.com/reference/android/support/v4/view/ViewPager.SavedState)
  - [ViewPager.SimpleOnPageChangeListener](https://developer.android.com/reference/android/support/v4/view/ViewPager.SimpleOnPageChangeListener)
  - [ViewParentCompat](https://developer.android.com/reference/android/support/v4/view/ViewParentCompat)
  - [ViewPropertyAnimatorCompat](https://developer.android.com/reference/android/support/v4/view/ViewPropertyAnimatorCompat)
  - [ViewPropertyAnimatorListenerAdapter](https://developer.android.com/reference/android/support/v4/view/ViewPropertyAnimatorListenerAdapter)
  - [WindowCompat](https://developer.android.com/reference/android/support/v4/view/WindowCompat)
  - [WindowInsetsCompat](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat)