# ListPopupWindow

added in[version 25.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:appcompat-v7:28.0.0-alpha1  
Summary:[Constants](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#constants)\|[Ctors](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#pubctors)\|[Methods](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#)  

# ListPopupWindow

| 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


class
ListPopupWindow
`  
`

extends Object


``


`

|---|-------------------------------------------|
| java.lang.Object                             ||
| ↳ | android.support.v7.widget.ListPopupWindow |

<br />

*** ** * ** ***

Static library support version of the framework's[ListPopupWindow](https://developer.android.com/reference/android/widget/ListPopupWindow.html). Used to write apps that run on platforms prior to Android L. When running on Android L or above, this implementation is still used; it does not try to switch to the framework's implementation. See the framework SDK documentation for a class overview.  
**See also:**

- [ListPopupWindow](https://developer.android.com/https://developer.android.com/reference/android/widget/ListPopupWindow)

## Summary

|                                                                                                                                                                                       ### Constants                                                                                                                                                                                       ||
|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [INPUT_METHOD_FROM_FOCUSABLE](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#INPUT_METHOD_FROM_FOCUSABLE) Mode for[setInputMethodMode(int)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setInputMethodMode(int)): the requirements for the input method should be based on the focusability of the popup. |
| `int` | [INPUT_METHOD_NEEDED](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#INPUT_METHOD_NEEDED) Mode for[setInputMethodMode(int)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setInputMethodMode(int)): this popup always needs to work with an input method, regardless of whether it is focusable.            |
| `int` | [INPUT_METHOD_NOT_NEEDED](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#INPUT_METHOD_NOT_NEEDED) Mode for[setInputMethodMode(int)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setInputMethodMode(int)): this popup never needs to work with an input method, regardless of whether it is focusable.     |
| `int` | [MATCH_PARENT](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#MATCH_PARENT) Alias for[MATCH_PARENT](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#MATCH_PARENT).                                                                                                                                             |
| `int` | [POSITION_PROMPT_ABOVE](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#POSITION_PROMPT_ABOVE) The provided prompt view should appear above list content.                                                                                                                                                                                        |
| `int` | [POSITION_PROMPT_BELOW](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#POSITION_PROMPT_BELOW) The provided prompt view should appear below list content.                                                                                                                                                                                        |
| `int` | [WRAP_CONTENT](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#WRAP_CONTENT) Alias for[WRAP_CONTENT](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#WRAP_CONTENT).                                                                                                                                             |

|                                                                                                                                                                                                                                          ### Public constructors                                                                                                                                                                                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[ListPopupWindow](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#ListPopupWindow(android.content.Context))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context) ` Create a new, empty popup window capable of displaying items from a ListAdapter.                                                                                                                                                                         |
| ` `[ListPopupWindow](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#ListPopupWindow(android.content.Context, android.util.AttributeSet))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context, `[AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html)` attrs) ` Create a new, empty popup window capable of displaying items from a ListAdapter.                                              |
| ` `[ListPopupWindow](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#ListPopupWindow(android.content.Context, android.util.AttributeSet, int))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context, `[AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html)` attrs, int defStyleAttr) ` Create a new, empty popup window capable of displaying items from a ListAdapter.                       |
| ` `[ListPopupWindow](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#ListPopupWindow(android.content.Context, android.util.AttributeSet, int, int))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context, `[AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html)` attrs, int defStyleAttr, int defStyleRes) ` Create a new, empty popup window capable of displaying items from a ListAdapter. |

|                                                                                                                                                                                                                                                                                                                                                            ### Public methods                                                                                                                                                                                                                                                                                                                                                            ||
|-----------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void`                                                                                                   | ` `[clearListSelection](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#clearListSelection())`() ` Clear any current list selection.                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ` `[View.OnTouchListener](https://developer.android.com/reference/android/view/View.OnTouchListener.html) | ` `[createDragToOpenListener](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#createDragToOpenListener(android.view.View))`(`[View](https://developer.android.com/reference/android/view/View.html)` src) ` Returns an[View.OnTouchListener](https://developer.android.com/reference/android/view/View.OnTouchListener.html)that can be added to the source view to implement drag-to-open behavior.                                                                                                                                                                                        |
| ` void`                                                                                                   | ` `[dismiss](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#dismiss())`() ` Dismiss the popup window.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` `[View](https://developer.android.com/reference/android/view/View.html)                                 | ` `[getAnchorView](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getAnchorView())`() ` Returns the view that will be used to anchor this popup.                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` int`                                                                                                    | ` `[getAnimationStyle](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getAnimationStyle())`() ` Returns the animation style that will be used when the popup window is shown or dismissed.                                                                                                                                                                                                                                                                                                                                                                                                 |
| ` `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)            | ` `[getBackground](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getBackground())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ` int`                                                                                                    | ` `[getHeight](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getHeight())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` int`                                                                                                    | ` `[getHorizontalOffset](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getHorizontalOffset())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ` int`                                                                                                    | ` `[getInputMethodMode](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getInputMethodMode())`() ` Return the current value in[setInputMethodMode(int)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setInputMethodMode(int)).                                                                                                                                                                                                                                                                                                                         |
| ` `[ListView](https://developer.android.com/reference/android/widget/ListView.html)                       | ` `[getListView](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getListView())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ` int`                                                                                                    | ` `[getPromptPosition](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getPromptPosition())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` Object`                                                                                                 | ` `[getSelectedItem](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getSelectedItem())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` long`                                                                                                   | ` `[getSelectedItemId](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getSelectedItemId())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` int`                                                                                                    | ` `[getSelectedItemPosition](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getSelectedItemPosition())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` `[View](https://developer.android.com/reference/android/view/View.html)                                 | ` `[getSelectedView](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getSelectedView())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` int`                                                                                                    | ` `[getSoftInputMode](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getSoftInputMode())`() ` Returns the current value in[setSoftInputMode(int)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setSoftInputMode(int)).                                                                                                                                                                                                                                                                                                                                |
| ` int`                                                                                                    | ` `[getVerticalOffset](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getVerticalOffset())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` int`                                                                                                    | ` `[getWidth](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getWidth())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` boolean`                                                                                                | ` `[isInputMethodNotNeeded](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#isInputMethodNotNeeded())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` boolean`                                                                                                | ` `[isModal](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#isModal())`() ` Returns whether the popup window will be modal when shown.                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` boolean`                                                                                                | ` `[isShowing](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#isShowing())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` boolean`                                                                                                | ` `[onKeyDown](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#onKeyDown(int, android.view.KeyEvent))`(int keyCode, `[KeyEvent](https://developer.android.com/reference/android/view/KeyEvent.html)` event) ` Filter key down events.                                                                                                                                                                                                                                                                                                                                                       |
| ` boolean`                                                                                                | ` `[onKeyPreIme](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#onKeyPreIme(int, android.view.KeyEvent))`(int keyCode, `[KeyEvent](https://developer.android.com/reference/android/view/KeyEvent.html)` event) ` Filter pre-IME key events.                                                                                                                                                                                                                                                                                                                                                |
| ` boolean`                                                                                                | ` `[onKeyUp](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#onKeyUp(int, android.view.KeyEvent))`(int keyCode, `[KeyEvent](https://developer.android.com/reference/android/view/KeyEvent.html)` event) ` Filter key up events.                                                                                                                                                                                                                                                                                                                                                             |
| ` boolean`                                                                                                | ` `[performItemClick](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#performItemClick(int))`(int position) ` Perform an item click operation on the specified list adapter position.                                                                                                                                                                                                                                                                                                                                                                                                       |
| ` void`                                                                                                   | ` `[postShow](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#postShow())`() ` Post a[show()](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#show())call to the UI thread.                                                                                                                                                                                                                                                                                                                                                                               |
| ` void`                                                                                                   | ` `[setAdapter](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setAdapter(android.widget.ListAdapter))`(`[ListAdapter](https://developer.android.com/reference/android/widget/ListAdapter.html)` adapter) ` Sets the adapter that provides the data and the views to represent the data in this popup window.                                                                                                                                                                                                                                                                              |
| ` void`                                                                                                   | ` `[setAnchorView](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setAnchorView(android.view.View))`(`[View](https://developer.android.com/reference/android/view/View.html)` anchor) ` Sets the popup's anchor view.                                                                                                                                                                                                                                                                                                                                                                      |
| ` void`                                                                                                   | ` `[setAnimationStyle](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setAnimationStyle(int))`(int animationStyle) ` Set an animation style to use when the popup window is shown or dismissed.                                                                                                                                                                                                                                                                                                                                                                                            |
| ` void`                                                                                                   | ` `[setBackgroundDrawable](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setBackgroundDrawable(android.graphics.drawable.Drawable))`(`[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)` d) ` Sets a drawable to be the background for the popup window.                                                                                                                                                                                                                                                                                        |
| ` void`                                                                                                   | ` `[setContentWidth](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setContentWidth(int))`(int width) ` Sets the width of the popup window by the size of its content.                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` void`                                                                                                   | ` `[setDropDownGravity](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setDropDownGravity(int))`(int gravity) ` Set the gravity of the dropdown list.                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` void`                                                                                                   | ` `[setHeight](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setHeight(int))`(int height) ` Sets the height of the popup window in pixels.                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` void`                                                                                                   | ` `[setHorizontalOffset](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setHorizontalOffset(int))`(int offset) ` Set the horizontal offset of this popup from its anchor view in pixels.                                                                                                                                                                                                                                                                                                                                                                                                   |
| ` void`                                                                                                   | ` `[setInputMethodMode](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setInputMethodMode(int))`(int mode) ` Control how the popup operates with an input method: one of[INPUT_METHOD_FROM_FOCUSABLE](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#INPUT_METHOD_FROM_FOCUSABLE),[INPUT_METHOD_NEEDED](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#INPUT_METHOD_NEEDED), or[INPUT_METHOD_NOT_NEEDED](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#INPUT_METHOD_NOT_NEEDED). |
| ` void`                                                                                                   | ` `[setListSelector](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setListSelector(android.graphics.drawable.Drawable))`(`[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)` selector) ` Sets a drawable to use as the list item selector.                                                                                                                                                                                                                                                                                                      |
| ` void`                                                                                                   | ` `[setModal](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setModal(boolean))`(boolean modal) ` Set whether this window should be modal when shown.                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` void`                                                                                                   | ` `[setOnDismissListener](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setOnDismissListener(android.widget.PopupWindow.OnDismissListener))`(`[PopupWindow.OnDismissListener](https://developer.android.com/reference/android/widget/PopupWindow.OnDismissListener.html)` listener) ` Set a listener to receive a callback when the popup is dismissed.                                                                                                                                                                                                                                   |
| ` void`                                                                                                   | ` `[setOnItemClickListener](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setOnItemClickListener(android.widget.AdapterView.OnItemClickListener))`(`[AdapterView.OnItemClickListener](https://developer.android.com/reference/android/widget/AdapterView.OnItemClickListener.html)` clickListener) ` Sets a listener to receive events when a list item is clicked.                                                                                                                                                                                                                       |
| ` void`                                                                                                   | ` `[setOnItemSelectedListener](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener))`(`[AdapterView.OnItemSelectedListener](https://developer.android.com/reference/android/widget/AdapterView.OnItemSelectedListener.html)` selectedListener) ` Sets a listener to receive events when a list item is selected.                                                                                                                                                                                                    |
| ` void`                                                                                                   | ` `[setPromptPosition](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setPromptPosition(int))`(int position) ` Set where the optional prompt view should appear.                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` void`                                                                                                   | ` `[setPromptView](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setPromptView(android.view.View))`(`[View](https://developer.android.com/reference/android/view/View.html)` prompt) ` Set a view to act as a user prompt for this popup window.                                                                                                                                                                                                                                                                                                                                          |
| ` void`                                                                                                   | ` `[setSelection](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setSelection(int))`(int position) ` Set the selected position of the list.                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` void`                                                                                                   | ` `[setSoftInputMode](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setSoftInputMode(int))`(int mode) ` Sets the operating mode for the soft input area.                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` void`                                                                                                   | ` `[setVerticalOffset](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setVerticalOffset(int))`(int offset) ` Set the vertical offset of this popup from its anchor view in pixels.                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` void`                                                                                                   | ` `[setWidth](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setWidth(int))`(int width) ` Sets the width of the popup window in pixels.                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ` void`                                                                                                   | ` `[setWindowLayoutType](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setWindowLayoutType(int))`(int layoutType) ` Set the layout type for this popup window.                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` void`                                                                                                   | ` `[show](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#show())`() ` Show the popup list.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |

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

### INPUT_METHOD_FROM_FOCUSABLE

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

```
int INPUT_METHOD_FROM_FOCUSABLE
```

Mode for[setInputMethodMode(int)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setInputMethodMode(int)): the requirements for the input method should be based on the focusability of the popup. That is if it is focusable than it needs to work with the input method, else it doesn't.

<br />

Constant Value: 0 (0x00000000)  

### INPUT_METHOD_NEEDED

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

```
int INPUT_METHOD_NEEDED
```

Mode for[setInputMethodMode(int)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setInputMethodMode(int)): this popup always needs to work with an input method, regardless of whether it is focusable. This means that it will always be displayed so that the user can also operate the input method while it is shown.

<br />

Constant Value: 1 (0x00000001)  

### INPUT_METHOD_NOT_NEEDED

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

```
int INPUT_METHOD_NOT_NEEDED
```

Mode for[setInputMethodMode(int)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setInputMethodMode(int)): this popup never needs to work with an input method, regardless of whether it is focusable. This means that it will always be displayed to use as much space on the screen as needed, regardless of whether this covers the input method.

<br />

Constant Value: 2 (0x00000002)  

### MATCH_PARENT

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

```
int MATCH_PARENT
```

Alias for[MATCH_PARENT](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#MATCH_PARENT). If used to specify a popup width, the popup will match the width of the anchor view. If used to specify a popup height, the popup will fill available space.

<br />

Constant Value: -1 (0xffffffff)  

### POSITION_PROMPT_ABOVE

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

```
int POSITION_PROMPT_ABOVE
```

The provided prompt view should appear above list content.

<br />

**See also:**

- [setPromptPosition(int)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setPromptPosition(int))
- [getPromptPosition()](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getPromptPosition())
- [setPromptView(View)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setPromptView(android.view.View))

Constant Value: 0 (0x00000000)  

### POSITION_PROMPT_BELOW

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

```
int POSITION_PROMPT_BELOW
```

The provided prompt view should appear below list content.

<br />

**See also:**

- [setPromptPosition(int)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setPromptPosition(int))
- [getPromptPosition()](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getPromptPosition())
- [setPromptView(View)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setPromptView(android.view.View))

Constant Value: 1 (0x00000001)  

### WRAP_CONTENT

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

```
int WRAP_CONTENT
```

Alias for[WRAP_CONTENT](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#WRAP_CONTENT). If used to specify a popup width, the popup will use the width of its content.

<br />

Constant Value: -2 (0xfffffffe)

## Public constructors

### ListPopupWindow

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

```
ListPopupWindow (Context context)
```

Create a new, empty popup window capable of displaying items from a ListAdapter. Backgrounds should be set using[setBackgroundDrawable(Drawable)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setBackgroundDrawable(android.graphics.drawable.Drawable)).

<br />

|                           Parameters                           ||
|-----------|-----------------------------------------------------|
| `context` | `Context`: Context used for contained views. <br /> |

### ListPopupWindow

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

```
ListPopupWindow (Context context, 
                AttributeSet attrs)
```

Create a new, empty popup window capable of displaying items from a ListAdapter. Backgrounds should be set using[setBackgroundDrawable(Drawable)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setBackgroundDrawable(android.graphics.drawable.Drawable)).

<br />

|                                            Parameters                                             ||
|-----------|----------------------------------------------------------------------------------------|
| `context` | `Context`: Context used for contained views. <br />                                    |
| `attrs`   | `AttributeSet`: Attributes from inflating parent views used to style the popup. <br /> |

### ListPopupWindow

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

```
ListPopupWindow (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)
```

Create a new, empty popup window capable of displaying items from a ListAdapter. Backgrounds should be set using[setBackgroundDrawable(Drawable)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setBackgroundDrawable(android.graphics.drawable.Drawable)).

<br />

|                                               Parameters                                               ||
|----------------|----------------------------------------------------------------------------------------|
| `context`      | `Context`: Context used for contained views. <br />                                    |
| `attrs`        | `AttributeSet`: Attributes from inflating parent views used to style the popup. <br /> |
| `defStyleAttr` | `int`: Default style attribute to use for popup content. <br />                        |

### ListPopupWindow

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

```
ListPopupWindow (Context context, 
                AttributeSet attrs, 
                int defStyleAttr, 
                int defStyleRes)
```

Create a new, empty popup window capable of displaying items from a ListAdapter. Backgrounds should be set using[setBackgroundDrawable(Drawable)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setBackgroundDrawable(android.graphics.drawable.Drawable)).

<br />

|                                               Parameters                                               ||
|----------------|----------------------------------------------------------------------------------------|
| `context`      | `Context`: Context used for contained views. <br />                                    |
| `attrs`        | `AttributeSet`: Attributes from inflating parent views used to style the popup. <br /> |
| `defStyleAttr` | `int`: Style attribute to read for default styling of popup content. <br />            |
| `defStyleRes`  | `int`: Style resource ID to use for default styling of popup content. <br />           |

## Public methods

### clearListSelection

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

```
void clearListSelection ()
```

Clear any current list selection. Only valid when[isShowing()](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#isShowing())==`true`.

<br />

### createDragToOpenListener

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

```
View.OnTouchListener createDragToOpenListener (View src)
```

Returns an[View.OnTouchListener](https://developer.android.com/reference/android/view/View.OnTouchListener.html)that can be added to the source view to implement drag-to-open behavior. Generally, the source view should be the same view that was passed to[setAnchorView(View)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setAnchorView(android.view.View)).

When the listener is set on a view, touching that view and dragging outside of its bounds will open the popup window. Lifting will select the currently touched list item.

Example usage:  

```
 ListPopupWindow myPopup = new ListPopupWindow(context);
 myPopup.setAnchor(myAnchor);
 OnTouchListener dragListener = myPopup.createDragToOpenListener(myAnchor);
 myAnchor.setOnTouchListener(dragListener);
 
```

<br />

<br />

|                                 Parameters                                 ||
|-------|---------------------------------------------------------------------|
| `src` | `View`: the view on which the resulting listener will be set <br /> |

|                                                                               Returns                                                                               ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------|
| [View.OnTouchListener](https://developer.android.com/reference/android/view/View.OnTouchListener.html) | a touch listener that controls drag-to-open behavior <br /> |

### dismiss

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

```
void dismiss ()
```

Dismiss the popup window.

<br />

### getAnchorView

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

```
View getAnchorView ()
```

Returns the view that will be used to anchor this popup.

<br />

|                                                Returns                                                 ||
|------------------------------------------------------------------------|--------------------------------|
| [View](https://developer.android.com/reference/android/view/View.html) | The popup's anchor view <br /> |

### getAnimationStyle

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

```
int getAnimationStyle ()
```

Returns the animation style that will be used when the popup window is shown or dismissed.

<br />

|                     Returns                      ||
|-------|-------------------------------------------|
| `int` | Animation style that will be used. <br /> |

### getBackground

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

```
Drawable getBackground ()
```

<br />

<br />

|                                                                      Returns                                                                      ||
|---------------------------------------------------------------------------------------------|------------------------------------------------------|
| [Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) | The background drawable for the popup window. <br /> |

### getHeight

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

```
int getHeight ()
```

<br />

<br />

|                         Returns                         ||
|-------|--------------------------------------------------|
| `int` | The height of the popup window in pixels. <br /> |

### getHorizontalOffset

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

```
int getHorizontalOffset ()
```

<br />

<br />

|                                   Returns                                   ||
|-------|----------------------------------------------------------------------|
| `int` | The horizontal offset of the popup from its anchor in pixels. <br /> |

### getInputMethodMode

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

```
int getInputMethodMode ()
```

Return the current value in[setInputMethodMode(int)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setInputMethodMode(int)).

<br />

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

**See also:**

- [setInputMethodMode(int)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setInputMethodMode(int))  

### getListView

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

```
ListView getListView ()
```

<br />

<br />

|                                                                                                                                                                       Returns                                                                                                                                                                       ||
|----------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ListView](https://developer.android.com/reference/android/widget/ListView.html) | The[ListView](https://developer.android.com/reference/android/widget/ListView.html)displayed within the popup window. Only valid when[isShowing()](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#isShowing())==`true`. <br /> |

### getPromptPosition

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

```
int getPromptPosition ()
```

<br />

<br />

|                           Returns                           ||
|-------|------------------------------------------------------|
| `int` | Where the optional prompt view should appear. <br /> |

**See also:**

- [POSITION_PROMPT_ABOVE](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#POSITION_PROMPT_ABOVE)
- [POSITION_PROMPT_BELOW](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#POSITION_PROMPT_BELOW)  

### getSelectedItem

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

```
Object getSelectedItem ()
```

<br />

<br />

|                                      Returns                                      ||
|----------|-------------------------------------------------------------------------|
| `Object` | The currently selected item or null if the popup is not showing. <br /> |

### getSelectedItemId

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

```
long getSelectedItemId ()
```

<br />

<br />

|                                                                                                                                         Returns                                                                                                                                         ||
|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `long` | The ID of the currently selected item or[INVALID_ROW_ID](https://developer.android.com/reference/android/widget/AdapterView.html#INVALID_ROW_ID)if[isShowing()](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#isShowing())==`false`. <br /> |

**See also:**

- [getSelectedItemId()](https://developer.android.com/https://developer.android.com/reference/android/widget/AdapterView#getSelectedItemId())  

### getSelectedItemPosition

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

```
int getSelectedItemPosition ()
```

<br />

<br />

|                                                                                                                                             Returns                                                                                                                                              ||
|-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | The position of the currently selected item or[INVALID_POSITION](https://developer.android.com/reference/android/widget/AdapterView.html#INVALID_POSITION)if[isShowing()](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#isShowing())==`false`. <br /> |

**See also:**

- [getSelectedItemPosition()](https://developer.android.com/https://developer.android.com/reference/android/widget/AdapterView#getSelectedItemPosition())  

### getSelectedView

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

```
View getSelectedView ()
```

<br />

<br />

|                                                                                                                         Returns                                                                                                                          ||
|------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [View](https://developer.android.com/reference/android/view/View.html) | The View for the currently selected item or null if[isShowing()](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#isShowing())==`false`. <br /> |

**See also:**

- [getSelectedView()](https://developer.android.com/https://developer.android.com/reference/android/widget/AbsListView#getSelectedView())  

### getSoftInputMode

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

```
int getSoftInputMode ()
```

Returns the current value in[setSoftInputMode(int)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setSoftInputMode(int)).

<br />

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

**See also:**

- [setSoftInputMode(int)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setSoftInputMode(int))
- [softInputMode](https://developer.android.com/https://developer.android.com/reference/android/view/WindowManager.LayoutParams#softInputMode)  

### getVerticalOffset

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

```
int getVerticalOffset ()
```

<br />

<br />

|                                  Returns                                  ||
|-------|--------------------------------------------------------------------|
| `int` | The vertical offset of the popup from its anchor in pixels. <br /> |

### getWidth

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

```
int getWidth ()
```

<br />

<br />

|                        Returns                         ||
|-------|-------------------------------------------------|
| `int` | The width of the popup window in pixels. <br /> |

### isInputMethodNotNeeded

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

```
boolean isInputMethodNotNeeded ()
```

<br />

<br />

|                                                                       Returns                                                                       ||
|-----------|------------------------------------------------------------------------------------------------------------------------------------------|
| `boolean` | `true`if this popup is configured to assume the user does not need to interact with the IME while it is showing,`false`otherwise. <br /> |

### isModal

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

```
boolean isModal ()
```

Returns whether the popup window will be modal when shown.

<br />

|                                   Returns                                   ||
|-----------|------------------------------------------------------------------|
| `boolean` | `true`if the popup window will be modal,`false`otherwise. <br /> |

### isShowing

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

```
boolean isShowing ()
```

<br />

<br />

|                                   Returns                                   ||
|-----------|------------------------------------------------------------------|
| `boolean` | `true`if the popup is currently showing,`false`otherwise. <br /> |

### onKeyDown

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

```
boolean onKeyDown (int keyCode, 
                KeyEvent event)
```

Filter key down events. By forwarding key down events to this function, views using non-modal ListPopupWindow can have it handle key selection of items.

<br />

|                                  Parameters                                   ||
|-----------|--------------------------------------------------------------------|
| `keyCode` | `int`: keyCode param passed to the host view's onKeyDown <br />    |
| `event`   | `KeyEvent`: event param passed to the host view's onKeyDown <br /> |

|                                  Returns                                  ||
|-----------|----------------------------------------------------------------|
| `boolean` | true if the event was handled, false if it was ignored. <br /> |

**See also:**

- [setModal(boolean)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setModal(boolean))
- [onKeyUp(int, KeyEvent)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#onKeyUp(int, android.view.KeyEvent))  

### onKeyPreIme

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

```
boolean onKeyPreIme (int keyCode, 
                KeyEvent event)
```

Filter pre-IME key events. By forwarding[onKeyPreIme(int, KeyEvent)](https://developer.android.com/reference/android/view/View.html#onKeyPreIme(int, android.view.KeyEvent))events to this function, views using ListPopupWindow can have it dismiss the popup when the back key is pressed.

<br />

|                                   Parameters                                    ||
|-----------|----------------------------------------------------------------------|
| `keyCode` | `int`: keyCode param passed to the host view's onKeyPreIme <br />    |
| `event`   | `KeyEvent`: event param passed to the host view's onKeyPreIme <br /> |

|                                  Returns                                  ||
|-----------|----------------------------------------------------------------|
| `boolean` | true if the event was handled, false if it was ignored. <br /> |

**See also:**

- [setModal(boolean)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setModal(boolean))  

### onKeyUp

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

```
boolean onKeyUp (int keyCode, 
                KeyEvent event)
```

Filter key up events. By forwarding key up events to this function, views using non-modal ListPopupWindow can have it handle key selection of items.

<br />

|                                 Parameters                                  ||
|-----------|------------------------------------------------------------------|
| `keyCode` | `int`: keyCode param passed to the host view's onKeyUp <br />    |
| `event`   | `KeyEvent`: event param passed to the host view's onKeyUp <br /> |

|                                  Returns                                  ||
|-----------|----------------------------------------------------------------|
| `boolean` | true if the event was handled, false if it was ignored. <br /> |

**See also:**

- [setModal(boolean)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setModal(boolean))
- [onKeyDown(int, KeyEvent)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#onKeyDown(int, android.view.KeyEvent))  

### performItemClick

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

```
boolean performItemClick (int position)
```

Perform an item click operation on the specified list adapter position.

<br />

|                             Parameters                              ||
|------------|---------------------------------------------------------|
| `position` | `int`: Adapter position for performing the click <br /> |

|                                                                      Returns                                                                      ||
|-----------|----------------------------------------------------------------------------------------------------------------------------------------|
| `boolean` | true if the click action could be performed, false if not. (e.g. if the popup was not showing, this method would return false.) <br /> |

### postShow

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

```
void postShow ()
```

Post a[show()](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#show())call to the UI thread.

<br />

### setAdapter

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

```
void setAdapter (ListAdapter adapter)
```

Sets the adapter that provides the data and the views to represent the data in this popup window.

<br />

|                                      Parameters                                      ||
|-----------|---------------------------------------------------------------------------|
| `adapter` | `ListAdapter`: The adapter to use to create this window's content. <br /> |

### setAnchorView

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

```
void setAnchorView (View anchor)
```

Sets the popup's anchor view. This popup will always be positioned relative to the anchor view when shown.

<br />

|                       Parameters                       ||
|----------|----------------------------------------------|
| `anchor` | `View`: The view to use as an anchor. <br /> |

### setAnimationStyle

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

```
void setAnimationStyle (int animationStyle)
```

Set an animation style to use when the popup window is shown or dismissed.

<br />

|                       Parameters                        ||
|------------------|---------------------------------------|
| `animationStyle` | `int`: Animation style to use. <br /> |

### setBackgroundDrawable

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

```
void setBackgroundDrawable (Drawable d)
```

Sets a drawable to be the background for the popup window.

<br />

|                          Parameters                          ||
|-----|---------------------------------------------------------|
| `d` | `Drawable`: A drawable to set as the background. <br /> |

### setContentWidth

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

```
void setContentWidth (int width)
```

Sets the width of the popup window by the size of its content. The final width may be larger to accommodate styled window dressing.

<br />

|                         Parameters                         ||
|---------|---------------------------------------------------|
| `width` | `int`: Desired width of content in pixels. <br /> |

### setDropDownGravity

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

```
void setDropDownGravity (int gravity)
```

Set the gravity of the dropdown list. This is commonly used to set gravity to START or END for alignment with the anchor.

<br />

|                  Parameters                   ||
|-----------|------------------------------------|
| `gravity` | `int`: Gravity value to use <br /> |

### setHeight

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

```
void setHeight (int height)
```

Sets the height of the popup window in pixels. Can also be[MATCH_PARENT](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#MATCH_PARENT).

<br />

|                                                                                                                                                  Parameters                                                                                                                                                   ||
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `height` | `int`: Height of the popup window must be a positive value,[MATCH_PARENT](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#MATCH_PARENT), or[WRAP_CONTENT](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#WRAP_CONTENT). <br /> |

|                             Throws                             ||
|----------------------------|------------------------------------|
| `IllegalArgumentException` | if height is set to negative value |

### setHorizontalOffset

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

```
void setHorizontalOffset (int offset)
```

Set the horizontal offset of this popup from its anchor view in pixels.

<br />

|                                 Parameters                                  ||
|----------|-------------------------------------------------------------------|
| `offset` | `int`: The horizontal offset of the popup from its anchor. <br /> |

### setInputMethodMode

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

```
void setInputMethodMode (int mode)
```

Control how the popup operates with an input method: one of[INPUT_METHOD_FROM_FOCUSABLE](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#INPUT_METHOD_FROM_FOCUSABLE),[INPUT_METHOD_NEEDED](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#INPUT_METHOD_NEEDED), or[INPUT_METHOD_NOT_NEEDED](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#INPUT_METHOD_NOT_NEEDED).

If the popup is showing, calling this method will take effect only the next time the popup is shown or through a manual call to the[show()](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#show())method.

<br />

<br />

|      Parameters      ||
|--------|--------------|
| `mode` | `int` <br /> |

**See also:**

- [getInputMethodMode()](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getInputMethodMode())
- [show()](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#show())  

### setListSelector

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

```
void setListSelector (Drawable selector)
```

Sets a drawable to use as the list item selector.

<br />

|                                 Parameters                                 ||
|------------|----------------------------------------------------------------|
| `selector` | `Drawable`: List selector drawable to use in the popup. <br /> |

### setModal

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

```
void setModal (boolean modal)
```

Set whether this window should be modal when shown.

If a popup window is modal, it will receive all touch and key input. If the user touches outside the popup window's content area the popup window will be dismissed.

<br />

|                                      Parameters                                       ||
|---------|------------------------------------------------------------------------------|
| `modal` | `boolean`:`true`if the popup window should be modal,`false`otherwise. <br /> |

### setOnDismissListener

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

```
void setOnDismissListener (PopupWindow.OnDismissListener listener)
```

Set a listener to receive a callback when the popup is dismissed.

<br />

|                                                   Parameters                                                    ||
|------------|-----------------------------------------------------------------------------------------------------|
| `listener` | `PopupWindow.OnDismissListener`: Listener that will be notified when the popup is dismissed. <br /> |

### setOnItemClickListener

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

```
void setOnItemClickListener (AdapterView.OnItemClickListener clickListener)
```

Sets a listener to receive events when a list item is clicked.

<br />

|                                   Parameters                                    ||
|-----------------|----------------------------------------------------------------|
| `clickListener` | `AdapterView.OnItemClickListener`: Listener to register <br /> |

**See also:**

- [setOnItemClickListener(android.widget.AdapterView.OnItemClickListener)](https://developer.android.com/https://developer.android.com/reference/android/widget/AdapterView#setOnItemClickListener(android.widget.AdapterView.OnItemClickListener))  

### setOnItemSelectedListener

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

```
void setOnItemSelectedListener (AdapterView.OnItemSelectedListener selectedListener)
```

Sets a listener to receive events when a list item is selected.

<br />

|                                       Parameters                                       ||
|--------------------|--------------------------------------------------------------------|
| `selectedListener` | `AdapterView.OnItemSelectedListener`: Listener to register. <br /> |

**See also:**

- [setOnItemSelectedListener(OnItemSelectedListener)](https://developer.android.com/https://developer.android.com/reference/android/widget/AdapterView#setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener))  

### setPromptPosition

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

```
void setPromptPosition (int position)
```

Set where the optional prompt view should appear. The default is[POSITION_PROMPT_ABOVE](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#POSITION_PROMPT_ABOVE).

<br />

|                                          Parameters                                           ||
|------------|-----------------------------------------------------------------------------------|
| `position` | `int`: A position constant declaring where the prompt should be displayed. <br /> |

**See also:**

- [POSITION_PROMPT_ABOVE](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#POSITION_PROMPT_ABOVE)
- [POSITION_PROMPT_BELOW](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#POSITION_PROMPT_BELOW)  

### setPromptView

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

```
void setPromptView (View prompt)
```

Set a view to act as a user prompt for this popup window. Where the prompt view will appear is controlled by[setPromptPosition(int)](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#setPromptPosition(int)).

<br />

|                            Parameters                            ||
|----------|--------------------------------------------------------|
| `prompt` | `View`: View to use as an informational prompt. <br /> |

### setSelection

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

```
void setSelection (int position)
```

Set the selected position of the list. Only valid when[isShowing()](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#isShowing())==`true`.

<br />

|                         Parameters                          ||
|------------|-------------------------------------------------|
| `position` | `int`: List position to set as selected. <br /> |

### setSoftInputMode

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

```
void setSoftInputMode (int mode)
```

Sets the operating mode for the soft input area.

<br />

|                                                                                   Parameters                                                                                    ||
|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `mode` | `int`: The desired mode, see[softInputMode](https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#softInputMode)for the full list <br /> |

**See also:**

- [softInputMode](https://developer.android.com/https://developer.android.com/reference/android/view/WindowManager.LayoutParams#softInputMode)
- [getSoftInputMode()](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#getSoftInputMode())  

### setVerticalOffset

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

```
void setVerticalOffset (int offset)
```

Set the vertical offset of this popup from its anchor view in pixels.

<br />

|                                Parameters                                 ||
|----------|-----------------------------------------------------------------|
| `offset` | `int`: The vertical offset of the popup from its anchor. <br /> |

### setWidth

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

```
void setWidth (int width)
```

Sets the width of the popup window in pixels. Can also be[MATCH_PARENT](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#MATCH_PARENT)or[WRAP_CONTENT](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow#WRAP_CONTENT).

<br />

|                    Parameters                     ||
|---------|------------------------------------------|
| `width` | `int`: Width of the popup window. <br /> |

### setWindowLayoutType

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

```
void setWindowLayoutType (int layoutType)
```

Set the layout type for this popup window.

See[type](https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#type)for possible values.

<br />

|                        Parameters                        ||
|--------------|--------------------------------------------|
| `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)  

### show

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

```
void show ()
```

Show the popup list. If the list is already showing, this method will recalculate the popup's size and position.

<br />

-

  ## Annotations

  - [RecyclerView.EdgeEffectFactory.EdgeDirection](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.EdgeEffectFactory.EdgeDirection)
  - [RecyclerView.ItemAnimator.AdapterChanges](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemAnimator.AdapterChanges)
-

  ## Interfaces

  - [ActionMenuView.OnMenuItemClickListener](https://developer.android.com/reference/android/support/v7/widget/ActionMenuView.OnMenuItemClickListener)
  - [PopupMenu.OnDismissListener](https://developer.android.com/reference/android/support/v7/widget/PopupMenu.OnDismissListener)
  - [PopupMenu.OnMenuItemClickListener](https://developer.android.com/reference/android/support/v7/widget/PopupMenu.OnMenuItemClickListener)
  - [RecyclerView.ChildDrawingOrderCallback](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ChildDrawingOrderCallback)
  - [RecyclerView.ItemAnimator.ItemAnimatorFinishedListener](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemAnimator.ItemAnimatorFinishedListener)
  - [RecyclerView.LayoutManager.LayoutPrefetchRegistry](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutManager.LayoutPrefetchRegistry)
  - [RecyclerView.OnChildAttachStateChangeListener](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.OnChildAttachStateChangeListener)
  - [RecyclerView.OnItemTouchListener](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.OnItemTouchListener)
  - [RecyclerView.RecyclerListener](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.RecyclerListener)
  - [RecyclerView.SmoothScroller.ScrollVectorProvider](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller.ScrollVectorProvider)
  - [SearchView.OnCloseListener](https://developer.android.com/reference/android/support/v7/widget/SearchView.OnCloseListener)
  - [SearchView.OnQueryTextListener](https://developer.android.com/reference/android/support/v7/widget/SearchView.OnQueryTextListener)
  - [SearchView.OnSuggestionListener](https://developer.android.com/reference/android/support/v7/widget/SearchView.OnSuggestionListener)
  - [ShareActionProvider.OnShareTargetSelectedListener](https://developer.android.com/reference/android/support/v7/widget/ShareActionProvider.OnShareTargetSelectedListener)
  - [ThemedSpinnerAdapter](https://developer.android.com/reference/android/support/v7/widget/ThemedSpinnerAdapter)
  - [Toolbar.OnMenuItemClickListener](https://developer.android.com/reference/android/support/v7/widget/Toolbar.OnMenuItemClickListener)
-

  ## Classes

  - [ActionMenuView](https://developer.android.com/reference/android/support/v7/widget/ActionMenuView)
  - [ActionMenuView.LayoutParams](https://developer.android.com/reference/android/support/v7/widget/ActionMenuView.LayoutParams)
  - [AppCompatAutoCompleteTextView](https://developer.android.com/reference/android/support/v7/widget/AppCompatAutoCompleteTextView)
  - [AppCompatButton](https://developer.android.com/reference/android/support/v7/widget/AppCompatButton)
  - [AppCompatCheckBox](https://developer.android.com/reference/android/support/v7/widget/AppCompatCheckBox)
  - [AppCompatCheckedTextView](https://developer.android.com/reference/android/support/v7/widget/AppCompatCheckedTextView)
  - [AppCompatEditText](https://developer.android.com/reference/android/support/v7/widget/AppCompatEditText)
  - [AppCompatImageButton](https://developer.android.com/reference/android/support/v7/widget/AppCompatImageButton)
  - [AppCompatImageView](https://developer.android.com/reference/android/support/v7/widget/AppCompatImageView)
  - [AppCompatMultiAutoCompleteTextView](https://developer.android.com/reference/android/support/v7/widget/AppCompatMultiAutoCompleteTextView)
  - [AppCompatRadioButton](https://developer.android.com/reference/android/support/v7/widget/AppCompatRadioButton)
  - [AppCompatRatingBar](https://developer.android.com/reference/android/support/v7/widget/AppCompatRatingBar)
  - [AppCompatSeekBar](https://developer.android.com/reference/android/support/v7/widget/AppCompatSeekBar)
  - [AppCompatSpinner](https://developer.android.com/reference/android/support/v7/widget/AppCompatSpinner)
  - [AppCompatTextView](https://developer.android.com/reference/android/support/v7/widget/AppCompatTextView)
  - [CardView](https://developer.android.com/reference/android/support/v7/widget/CardView)
  - [DefaultItemAnimator](https://developer.android.com/reference/android/support/v7/widget/DefaultItemAnimator)
  - [DividerItemDecoration](https://developer.android.com/reference/android/support/v7/widget/DividerItemDecoration)
  - [GridLayout](https://developer.android.com/reference/android/support/v7/widget/GridLayout)
  - [GridLayout.Alignment](https://developer.android.com/reference/android/support/v7/widget/GridLayout.Alignment)
  - [GridLayout.LayoutParams](https://developer.android.com/reference/android/support/v7/widget/GridLayout.LayoutParams)
  - [GridLayout.Spec](https://developer.android.com/reference/android/support/v7/widget/GridLayout.Spec)
  - [GridLayoutManager](https://developer.android.com/reference/android/support/v7/widget/GridLayoutManager)
  - [GridLayoutManager.DefaultSpanSizeLookup](https://developer.android.com/reference/android/support/v7/widget/GridLayoutManager.DefaultSpanSizeLookup)
  - [GridLayoutManager.LayoutParams](https://developer.android.com/reference/android/support/v7/widget/GridLayoutManager.LayoutParams)
  - [GridLayoutManager.SpanSizeLookup](https://developer.android.com/reference/android/support/v7/widget/GridLayoutManager.SpanSizeLookup)
  - [LinearLayoutCompat](https://developer.android.com/reference/android/support/v7/widget/LinearLayoutCompat)
  - [LinearLayoutCompat.LayoutParams](https://developer.android.com/reference/android/support/v7/widget/LinearLayoutCompat.LayoutParams)
  - [LinearLayoutManager](https://developer.android.com/reference/android/support/v7/widget/LinearLayoutManager)
  - [LinearLayoutManager.LayoutChunkResult](https://developer.android.com/reference/android/support/v7/widget/LinearLayoutManager.LayoutChunkResult)
  - [LinearSmoothScroller](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller)
  - [LinearSnapHelper](https://developer.android.com/reference/android/support/v7/widget/LinearSnapHelper)
  - [ListPopupWindow](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow)
  - [OrientationHelper](https://developer.android.com/reference/android/support/v7/widget/OrientationHelper)
  - [PagerSnapHelper](https://developer.android.com/reference/android/support/v7/widget/PagerSnapHelper)
  - [PopupMenu](https://developer.android.com/reference/android/support/v7/widget/PopupMenu)
  - [RecyclerView](https://developer.android.com/reference/android/support/v7/widget/RecyclerView)
  - [RecyclerView.Adapter](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Adapter)
  - [RecyclerView.AdapterDataObserver](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.AdapterDataObserver)
  - [RecyclerView.EdgeEffectFactory](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.EdgeEffectFactory)
  - [RecyclerView.ItemAnimator](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemAnimator)
  - [RecyclerView.ItemAnimator.ItemHolderInfo](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemAnimator.ItemHolderInfo)
  - [RecyclerView.ItemDecoration](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemDecoration)
  - [RecyclerView.LayoutManager](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutManager)
  - [RecyclerView.LayoutManager.Properties](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutManager.Properties)
  - [RecyclerView.LayoutParams](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutParams)
  - [RecyclerView.OnFlingListener](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.OnFlingListener)
  - [RecyclerView.OnScrollListener](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.OnScrollListener)
  - [RecyclerView.RecycledViewPool](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.RecycledViewPool)
  - [RecyclerView.Recycler](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Recycler)
  - [RecyclerView.SimpleOnItemTouchListener](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SimpleOnItemTouchListener)
  - [RecyclerView.SmoothScroller](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller)
  - [RecyclerView.SmoothScroller.Action](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller.Action)
  - [RecyclerView.State](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.State)
  - [RecyclerView.ViewCacheExtension](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ViewCacheExtension)
  - [RecyclerView.ViewHolder](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ViewHolder)
  - [RecyclerViewAccessibilityDelegate](https://developer.android.com/reference/android/support/v7/widget/RecyclerViewAccessibilityDelegate)
  - [RecyclerViewAccessibilityDelegate.ItemDelegate](https://developer.android.com/reference/android/support/v7/widget/RecyclerViewAccessibilityDelegate.ItemDelegate)
  - [SearchView](https://developer.android.com/reference/android/support/v7/widget/SearchView)
  - [ShareActionProvider](https://developer.android.com/reference/android/support/v7/widget/ShareActionProvider)
  - [SimpleItemAnimator](https://developer.android.com/reference/android/support/v7/widget/SimpleItemAnimator)
  - [SnapHelper](https://developer.android.com/reference/android/support/v7/widget/SnapHelper)
  - [StaggeredGridLayoutManager](https://developer.android.com/reference/android/support/v7/widget/StaggeredGridLayoutManager)
  - [StaggeredGridLayoutManager.LayoutParams](https://developer.android.com/reference/android/support/v7/widget/StaggeredGridLayoutManager.LayoutParams)
  - [SwitchCompat](https://developer.android.com/reference/android/support/v7/widget/SwitchCompat)
  - [ThemedSpinnerAdapter.Helper](https://developer.android.com/reference/android/support/v7/widget/ThemedSpinnerAdapter.Helper)
  - [Toolbar](https://developer.android.com/reference/android/support/v7/widget/Toolbar)
  - [Toolbar.LayoutParams](https://developer.android.com/reference/android/support/v7/widget/Toolbar.LayoutParams)
  - [Toolbar.SavedState](https://developer.android.com/reference/android/support/v7/widget/Toolbar.SavedState)
  - [TooltipCompat](https://developer.android.com/reference/android/support/v7/widget/TooltipCompat)