# PopupWindowCompat

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:[Methods](https://developer.android.com/reference/android/support/v4/widget/PopupWindowCompat#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v4/widget/PopupWindowCompat#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v4/widget/PopupWindowCompat#)  

# PopupWindowCompat

| 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
PopupWindowCompat
`  
`

extends Object


``


`

|---|---------------------------------------------|
| java.lang.Object                               ||
| ↳ | android.support.v4.widget.PopupWindowCompat |

<br />

*** ** * ** ***

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

## Summary

|                                                                                                                                                                                                                                                                                 ### Public methods                                                                                                                                                                                                                                                                                 ||
|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static boolean` | ` `[getOverlapAnchor](https://developer.android.com/reference/android/support/v4/widget/PopupWindowCompat#getOverlapAnchor(android.widget.PopupWindow))`(`[PopupWindow](https://developer.android.com/reference/android/widget/PopupWindow.html)` popupWindow) ` Returns whether the popup window should overlap its anchor view when displayed as a drop-down.                                                                                                                                                                                                 |
| ` static int`     | ` `[getWindowLayoutType](https://developer.android.com/reference/android/support/v4/widget/PopupWindowCompat#getWindowLayoutType(android.widget.PopupWindow))`(`[PopupWindow](https://developer.android.com/reference/android/widget/PopupWindow.html)` popupWindow) ` Returns the layout type for this window.                                                                                                                                                                                                                                                 |
| ` static void`    | ` `[setOverlapAnchor](https://developer.android.com/reference/android/support/v4/widget/PopupWindowCompat#setOverlapAnchor(android.widget.PopupWindow, boolean))`(`[PopupWindow](https://developer.android.com/reference/android/widget/PopupWindow.html)` popupWindow, boolean overlapAnchor) ` Sets whether the popup window should overlap its anchor view when displayed as a drop-down.                                                                                                                                                                    |
| ` static void`    | ` `[setWindowLayoutType](https://developer.android.com/reference/android/support/v4/widget/PopupWindowCompat#setWindowLayoutType(android.widget.PopupWindow, int))`(`[PopupWindow](https://developer.android.com/reference/android/widget/PopupWindow.html)` popupWindow, int layoutType) ` Set the layout type for this window.                                                                                                                                                                                                                                |
| ` static void`    | ` `[showAsDropDown](https://developer.android.com/reference/android/support/v4/widget/PopupWindowCompat#showAsDropDown(android.widget.PopupWindow, android.view.View, int, int, int))`(`[PopupWindow](https://developer.android.com/reference/android/widget/PopupWindow.html)` popup, `[View](https://developer.android.com/reference/android/view/View.html)` anchor, int xoff, int yoff, int gravity) ` <br /> Display the content view in a popup window anchored to the bottom-left corner of the anchor view offset by the specified x and y coordinates. |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4/widget/PopupWindowCompat#)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() `                    | ||

## Public methods

### getOverlapAnchor

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

```
boolean getOverlapAnchor (PopupWindow popupWindow)
```

Returns whether the popup window should overlap its anchor view when displayed as a drop-down.

<br />

|             Parameters              ||
|---------------|----------------------|
| `popupWindow` | `PopupWindow` <br /> |

|                            Returns                             ||
|-----------|-----------------------------------------------------|
| `boolean` | Whether the popup should overlap its anchor. <br /> |

### getWindowLayoutType

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

```
int getWindowLayoutType (PopupWindow popupWindow)
```

Returns the layout type for this window.

<br />

|             Parameters              ||
|---------------|----------------------|
| `popupWindow` | `PopupWindow` <br /> |

|    Returns    ||
|-------|--------|
| `int` | <br /> |

**See also:**

- [setWindowLayoutType(PopupWindow, int)](https://developer.android.com/reference/android/support/v4/widget/PopupWindowCompat#setWindowLayoutType(android.widget.PopupWindow, int))  

### setOverlapAnchor

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

```
void setOverlapAnchor (PopupWindow popupWindow, 
                boolean overlapAnchor)
```

Sets whether the popup window should overlap its anchor view when displayed as a drop-down.

<br />

|                                   Parameters                                    ||
|-----------------|----------------------------------------------------------------|
| `popupWindow`   | `PopupWindow` <br />                                           |
| `overlapAnchor` | `boolean`: Whether the popup should overlap its anchor. <br /> |

### setWindowLayoutType

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

```
void setWindowLayoutType (PopupWindow popupWindow, 
                int layoutType)
```

Set the layout type for this window. This value will be passed through to[type](https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#type)therefore the value should match any value[type](https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#type)accepts.

<br />

|                        Parameters                         ||
|---------------|--------------------------------------------|
| `popupWindow` | `PopupWindow` <br />                       |
| `layoutType`  | `int`: Layout type for this window. <br /> |

**See also:**

- [type](https://developer.android.com/https://developer.android.com/reference/android/view/WindowManager.LayoutParams#type)  

### showAsDropDown

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

```
void showAsDropDown (PopupWindow popup, 
                View anchor, 
                int xoff, 
                int yoff, 
                int gravity)
```

<br />

Display the content view in a popup window anchored to the bottom-left corner of the anchor view offset by the specified x and y coordinates. If there is not enough room on screen to show the popup in its entirety, this method tries to find a parent scroll view to scroll. If no parent scroll view can be scrolled, the bottom-left corner of the popup is pinned at the top left corner of the anchor view.

If the view later scrolls to move`anchor`to a different location, the popup will be moved correspondingly.

<br />

<br />

|                               Parameters                               ||
|-----------|-------------------------------------------------------------|
| `popup`   | `PopupWindow`: the PopupWindow to show <br />               |
| `anchor`  | `View`: the view on which to pin the popup window <br />    |
| `xoff`    | `int`: A horizontal offset from the anchor in pixels <br /> |
| `yoff`    | `int`: A vertical offset from the anchor in pixels <br />   |
| `gravity` | `int`: Alignment of the popup relative to the anchor <br /> |

-

  ## Interfaces

  - [DrawerLayout.DrawerListener](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.DrawerListener)
  - [NestedScrollView.OnScrollChangeListener](https://developer.android.com/reference/android/support/v4/widget/NestedScrollView.OnScrollChangeListener)
  - [SimpleCursorAdapter.CursorToStringConverter](https://developer.android.com/reference/android/support/v4/widget/SimpleCursorAdapter.CursorToStringConverter)
  - [SimpleCursorAdapter.ViewBinder](https://developer.android.com/reference/android/support/v4/widget/SimpleCursorAdapter.ViewBinder)
  - [SlidingPaneLayout.PanelSlideListener](https://developer.android.com/reference/android/support/v4/widget/SlidingPaneLayout.PanelSlideListener)
  - [SwipeRefreshLayout.OnChildScrollUpCallback](https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.OnChildScrollUpCallback)
  - [SwipeRefreshLayout.OnRefreshListener](https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.OnRefreshListener)
  - [TintableCompoundButton](https://developer.android.com/reference/android/support/v4/widget/TintableCompoundButton)
-

  ## Classes

  - [AutoScrollHelper](https://developer.android.com/reference/android/support/v4/widget/AutoScrollHelper)
  - [CircularProgressDrawable](https://developer.android.com/reference/android/support/v4/widget/CircularProgressDrawable)
  - [CompoundButtonCompat](https://developer.android.com/reference/android/support/v4/widget/CompoundButtonCompat)
  - [ContentLoadingProgressBar](https://developer.android.com/reference/android/support/v4/widget/ContentLoadingProgressBar)
  - [CursorAdapter](https://developer.android.com/reference/android/support/v4/widget/CursorAdapter)
  - [DrawerLayout](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout)
  - [DrawerLayout.LayoutParams](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.LayoutParams)
  - [DrawerLayout.SavedState](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.SavedState)
  - [DrawerLayout.SimpleDrawerListener](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.SimpleDrawerListener)
  - [EdgeEffectCompat](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat)
  - [ExploreByTouchHelper](https://developer.android.com/reference/android/support/v4/widget/ExploreByTouchHelper)
  - [ImageViewCompat](https://developer.android.com/reference/android/support/v4/widget/ImageViewCompat)
  - [ListPopupWindowCompat](https://developer.android.com/reference/android/support/v4/widget/ListPopupWindowCompat)
  - [ListViewAutoScrollHelper](https://developer.android.com/reference/android/support/v4/widget/ListViewAutoScrollHelper)
  - [ListViewCompat](https://developer.android.com/reference/android/support/v4/widget/ListViewCompat)
  - [NestedScrollView](https://developer.android.com/reference/android/support/v4/widget/NestedScrollView)
  - [PopupMenuCompat](https://developer.android.com/reference/android/support/v4/widget/PopupMenuCompat)
  - [PopupWindowCompat](https://developer.android.com/reference/android/support/v4/widget/PopupWindowCompat)
  - [ResourceCursorAdapter](https://developer.android.com/reference/android/support/v4/widget/ResourceCursorAdapter)
  - [ScrollerCompat](https://developer.android.com/reference/android/support/v4/widget/ScrollerCompat)
  - [SimpleCursorAdapter](https://developer.android.com/reference/android/support/v4/widget/SimpleCursorAdapter)
  - [SlidingPaneLayout](https://developer.android.com/reference/android/support/v4/widget/SlidingPaneLayout)
  - [SlidingPaneLayout.LayoutParams](https://developer.android.com/reference/android/support/v4/widget/SlidingPaneLayout.LayoutParams)
  - [SlidingPaneLayout.SimplePanelSlideListener](https://developer.android.com/reference/android/support/v4/widget/SlidingPaneLayout.SimplePanelSlideListener)
  - [Space](https://developer.android.com/reference/android/support/v4/widget/Space)
  - [SwipeRefreshLayout](https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout)
  - [TextViewCompat](https://developer.android.com/reference/android/support/v4/widget/TextViewCompat)
  - [ViewDragHelper](https://developer.android.com/reference/android/support/v4/widget/ViewDragHelper)
  - [ViewDragHelper.Callback](https://developer.android.com/reference/android/support/v4/widget/ViewDragHelper.Callback)