# ListPopupWindow

Artifact: [androidx.appcompat:appcompat](https://developer.android.com/jetpack/androidx/releases/appcompat) [View Source](https://cs.android.com/search?q=file:androidx/appcompat/widget/ListPopupWindow.java+class:androidx.appcompat.widget.ListPopupWindow) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

*** ** * ** ***


```
class ListPopupWindow
```

<br />

*** ** * ** ***

Static library support version of the framework's `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 |
|---|---|
| `https://developer.android.com/reference/android/widget/ListPopupWindow.html` |   |

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#INPUT_METHOD_FROM_FOCUSABLE() = 0` Mode for `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#setInputMethodMode(int)`: the requirements for the input method should be based on the focusability of the popup. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#INPUT_METHOD_NEEDED() = 1` Mode for `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#setInputMethodMode(int)`: this popup always needs to work with an input method, regardless of whether it is focusable. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#INPUT_METHOD_NOT_NEEDED() = 2` Mode for `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#setInputMethodMode(int)`: this popup never needs to work with an input method, regardless of whether it is focusable. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#MATCH_PARENT() = -1` Alias for `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#MATCH_PARENT`. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#POSITION_PROMPT_ABOVE() = 0` The provided prompt view should appear above list content. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#POSITION_PROMPT_BELOW() = 1` The provided prompt view should appear below list content. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#WRAP_CONTENT() = -2` Alias for `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#WRAP_CONTENT`. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#ListPopupWindow(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html)` Create a new, empty popup window capable of displaying items from a ListAdapter. |
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#ListPopupWindow(android.content.Context,android.util.AttributeSet)(context: https://developer.android.com/reference/android/content/Context.html, attrs: https://developer.android.com/reference/android/util/AttributeSet.html?)` Create a new, empty popup window capable of displaying items from a ListAdapter. |
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#ListPopupWindow(android.content.Context,android.util.AttributeSet,int)( context: https://developer.android.com/reference/android/content/Context.html, attrs: https://developer.android.com/reference/android/util/AttributeSet.html?, defStyleAttr: @https://developer.android.com/reference/kotlin/androidx/annotation/AttrRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Create a new, empty popup window capable of displaying items from a ListAdapter. |
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#ListPopupWindow(android.content.Context,android.util.AttributeSet,int,int)( context: https://developer.android.com/reference/android/content/Context.html, attrs: https://developer.android.com/reference/android/util/AttributeSet.html?, defStyleAttr: @https://developer.android.com/reference/kotlin/androidx/annotation/AttrRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, defStyleRes: @https://developer.android.com/reference/kotlin/androidx/annotation/StyleRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Create a new, empty popup window capable of displaying items from a ListAdapter. |

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

## Constants

### INPUT_METHOD_FROM_FOCUSABLE

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
const val INPUT_METHOD_FROM_FOCUSABLE = 0: Int
```

Mode for `https://developer.android.com/reference/kotlin/androidx/appcompat/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.

### INPUT_METHOD_NEEDED

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
const val INPUT_METHOD_NEEDED = 1: Int
```

Mode for `https://developer.android.com/reference/kotlin/androidx/appcompat/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.

### INPUT_METHOD_NOT_NEEDED

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
const val INPUT_METHOD_NOT_NEEDED = 2: Int
```

Mode for `https://developer.android.com/reference/kotlin/androidx/appcompat/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.

### MATCH_PARENT

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
const val MATCH_PARENT = -1: Int
```

Alias for `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.

### POSITION_PROMPT_ABOVE

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
const val POSITION_PROMPT_ABOVE = 0: Int
```

The provided prompt view should appear above list content.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#setPromptPosition(int)` |   |
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#getPromptPosition()` |   |
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#setPromptView(android.view.View)` |   |

### POSITION_PROMPT_BELOW

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
const val POSITION_PROMPT_BELOW = 1: Int
```

The provided prompt view should appear below list content.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#setPromptPosition(int)` |   |
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#getPromptPosition()` |   |
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#setPromptView(android.view.View)` |   |

### WRAP_CONTENT

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
const val WRAP_CONTENT = -2: Int
```

Alias for `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.

## Public constructors

### ListPopupWindow

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
ListPopupWindow(context: Context)
```

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

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | Context used for contained views. |

### ListPopupWindow

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

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

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

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | Context used for contained views. |
| `attrs: https://developer.android.com/reference/android/util/AttributeSet.html?` | Attributes from inflating parent views used to style the popup. |

### ListPopupWindow

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
ListPopupWindow(
    context: Context,
    attrs: AttributeSet?,
    defStyleAttr: @AttrRes Int
)
```

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

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | Context used for contained views. |
| `attrs: https://developer.android.com/reference/android/util/AttributeSet.html?` | Attributes from inflating parent views used to style the popup. |
| `defStyleAttr: @https://developer.android.com/reference/kotlin/androidx/annotation/AttrRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Default style attribute to use for popup content. |

### ListPopupWindow

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
ListPopupWindow(
    context: Context,
    attrs: AttributeSet?,
    defStyleAttr: @AttrRes Int,
    defStyleRes: @StyleRes Int
)
```

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

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | Context used for contained views. |
| `attrs: https://developer.android.com/reference/android/util/AttributeSet.html?` | Attributes from inflating parent views used to style the popup. |
| `defStyleAttr: @https://developer.android.com/reference/kotlin/androidx/annotation/AttrRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Style attribute to read for default styling of popup content. |
| `defStyleRes: @https://developer.android.com/reference/kotlin/androidx/annotation/StyleRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Style resource ID to use for default styling of popup content. |

## Public functions

### clearListSelection

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun clearListSelection(): Unit
```

Clear any current list selection. Only valid when `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#isShowing()` == `true`.

### createDragToOpenListener

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun createDragToOpenListener(src: View!): View.OnTouchListener!
```

Returns an `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 `https://developer.android.com/reference/kotlin/androidx/appcompat/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:

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

| Parameters |
|---|---|
| `src: https://developer.android.com/reference/android/view/View.html!` | the view on which the resulting listener will be set |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/view/View.OnTouchListener.html!` | a touch listener that controls drag-to-open behavior |

### dismiss

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun dismiss(): Unit
```

Dismiss the popup window.

### getAnchorView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun getAnchorView(): View?
```

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

| Returns |
|---|---|
| `https://developer.android.com/reference/android/view/View.html?` | The popup's anchor view |

### getAnimationStyle

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun getAnimationStyle(): @StyleRes Int
```

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

| Returns |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/StyleRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Animation style that will be used. |

### getBackground

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun getBackground(): Drawable?
```

| Returns |
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Drawable.html?` | The background drawable for the popup window. |

### getEpicenterBounds

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun getEpicenterBounds(): Rect?
```

Return custom anchor-relative bounds of the popup's transition epicenter

| Returns |
|---|---|
| `https://developer.android.com/reference/android/graphics/Rect.html?` | anchor-relative bounds, or @`null` if not set |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#setEpicenterBounds(android.graphics.Rect)` |   |

### getHeight

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun getHeight(): Int
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the popup window in pixels. |

### getHorizontalOffset

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun getHorizontalOffset(): Int
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The horizontal offset of the popup from its anchor in pixels. |

### getInputMethodMode

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun getInputMethodMode(): Int
```

Return the current value in `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#setInputMethodMode(int)`.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#setInputMethodMode(int)` |   |

### getListView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun getListView(): ListView?
```

| Returns |
|---|---|
| `https://developer.android.com/reference/android/widget/ListView.html?` | The `https://developer.android.com/reference/android/widget/ListView.html` displayed within the popup window. Only valid when `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#isShowing()` == `true`. |

### getPromptPosition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun getPromptPosition(): Int
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Where the optional prompt view should appear. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#POSITION_PROMPT_ABOVE()` |   |
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#POSITION_PROMPT_BELOW()` |   |

### getSelectedItem

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun getSelectedItem(): Any?
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | The currently selected item or null if the popup is not showing. |

### getSelectedItemId

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun getSelectedItemId(): Long
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The ID of the currently selected item or `https://developer.android.com/reference/android/widget/AdapterView.html#INVALID_ROW_ID` if `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#isShowing()` == `false`. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/widget/AdapterView.html#getSelectedItemId()` |   |

### getSelectedItemPosition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun getSelectedItemPosition(): Int
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The position of the currently selected item or `https://developer.android.com/reference/android/widget/AdapterView.html#INVALID_POSITION` if `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#isShowing()` == `false`. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/widget/AdapterView.html#getSelectedItemPosition()` |   |

### getSelectedView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun getSelectedView(): View?
```

| Returns |
|---|---|
| `https://developer.android.com/reference/android/view/View.html?` | The View for the currently selected item or null if `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#isShowing()` == `false`. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/widget/AbsListView.html#getSelectedView()` |   |

### getSoftInputMode

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun getSoftInputMode(): Int
```

Returns the current value in `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#setSoftInputMode(int)`.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#setSoftInputMode(int)` |   |
| `https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#softInputMode` |   |

### getVerticalOffset

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun getVerticalOffset(): Int
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The vertical offset of the popup from its anchor in pixels. |

### getWidth

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun getWidth(): Int
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the popup window in pixels. |

### isInputMethodNotNeeded

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun isInputMethodNotNeeded(): Boolean
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if this popup is configured to assume the user does not need to interact with the IME while it is showing, `false` otherwise. |

### isModal

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun isModal(): Boolean
```

Returns whether the popup window will be modal when shown.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the popup window will be modal, `false` otherwise. |

### isShowing

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun isShowing(): Boolean
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the popup is currently showing, `false` otherwise. |

### onKeyDown

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean
```

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.

| Parameters |
|---|---|
| `keyCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | keyCode param passed to the host view's onKeyDown |
| `event: https://developer.android.com/reference/android/view/KeyEvent.html` | event param passed to the host view's onKeyDown |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if the event was handled, false if it was ignored. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#setModal(boolean)` |   |
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#onKeyUp(int,android.view.KeyEvent)` |   |

### onKeyPreIme

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean
```

Filter pre-IME key events. By forwarding `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.

| Parameters |
|---|---|
| `keyCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | keyCode param passed to the host view's onKeyPreIme |
| `event: https://developer.android.com/reference/android/view/KeyEvent.html` | event param passed to the host view's onKeyPreIme |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if the event was handled, false if it was ignored. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#setModal(boolean)` |   |

### onKeyUp

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean
```

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.

| Parameters |
|---|---|
| `keyCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | keyCode param passed to the host view's onKeyUp |
| `event: https://developer.android.com/reference/android/view/KeyEvent.html` | event param passed to the host view's onKeyUp |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if the event was handled, false if it was ignored. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#setModal(boolean)` |   |
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#onKeyDown(int,android.view.KeyEvent)` |   |

### performItemClick

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun performItemClick(position: Int): Boolean
```

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

| Parameters |
|---|---|
| `position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Adapter position for performing the click |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if the click action could be performed, false if not. (e.g. if the popup was not showing, this method would return false.) |

### postShow

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun postShow(): Unit
```

Post a `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#show()` call to the UI thread.

### setAdapter

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setAdapter(adapter: ListAdapter?): Unit
```

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

| Parameters |
|---|---|
| `adapter: https://developer.android.com/reference/android/widget/ListAdapter.html?` | The adapter to use to create this window's content. |

### setAnchorView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setAnchorView(anchor: View?): Unit
```

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

| Parameters |
|---|---|
| `anchor: https://developer.android.com/reference/android/view/View.html?` | The view to use as an anchor. |

### setAnimationStyle

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setAnimationStyle(animationStyle: @StyleRes Int): Unit
```

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

| Parameters |
|---|---|
| `animationStyle: @https://developer.android.com/reference/kotlin/androidx/annotation/StyleRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Animation style to use. |

### setBackgroundDrawable

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setBackgroundDrawable(d: Drawable?): Unit
```

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

| Parameters |
|---|---|
| `d: https://developer.android.com/reference/android/graphics/drawable/Drawable.html?` | A drawable to set as the background. |

### setContentWidth

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setContentWidth(width: Int): Unit
```

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

| Parameters |
|---|---|
| `width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Desired width of content in pixels. |

### setDropDownGravity

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setDropDownGravity(gravity: Int): Unit
```

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

| Parameters |
|---|---|
| `gravity: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Gravity value to use |

### setEpicenterBounds

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setEpicenterBounds(bounds: Rect?): Unit
```

Specifies the custom anchor-relative bounds of the popup's transition epicenter.

| Parameters |
|---|---|
| `bounds: https://developer.android.com/reference/android/graphics/Rect.html?` | anchor-relative bounds or `null` to use default epicenter |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#getEpicenterBounds()` |   |

### setHeight

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setHeight(height: Int): Unit
```

Sets the height of the popup window in pixels. Can also be `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#MATCH_PARENT()`.

| Parameters |
|---|---|
| `height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Height of the popup window must be a positive value, `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#MATCH_PARENT()`, or `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#WRAP_CONTENT()`. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if height is set to negative value |

### setHorizontalOffset

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setHorizontalOffset(offset: Int): Unit
```

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

| Parameters |
|---|---|
| `offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The horizontal offset of the popup from its anchor. |

### setInputMethodMode

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setInputMethodMode(mode: Int): Unit
```

Control how the popup operates with an input method: one of `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#INPUT_METHOD_FROM_FOCUSABLE()`, `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#INPUT_METHOD_NEEDED()`, or `https://developer.android.com/reference/kotlin/androidx/appcompat/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 `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#show()` method.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#getInputMethodMode()` |   |
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#show()` |   |

### setListSelector

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setListSelector(selector: Drawable!): Unit
```

Sets a drawable to use as the list item selector.

| Parameters |
|---|---|
| `selector: https://developer.android.com/reference/android/graphics/drawable/Drawable.html!` | List selector drawable to use in the popup. |

### setModal

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setModal(modal: Boolean): Unit
```

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.

| Parameters |
|---|---|
| `modal: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the popup window should be modal, `false` otherwise. |

### setOnDismissListener

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setOnDismissListener(listener: PopupWindow.OnDismissListener?): Unit
```

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

| Parameters |
|---|---|
| `listener: https://developer.android.com/reference/android/widget/PopupWindow.OnDismissListener.html?` | Listener that will be notified when the popup is dismissed. |

### setOnItemClickListener

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setOnItemClickListener(clickListener: AdapterView.OnItemClickListener?): Unit
```

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

| Parameters |
|---|---|
| `clickListener: https://developer.android.com/reference/android/widget/AdapterView.OnItemClickListener.html?` | Listener to register |

| See also |
|---|---|
| `https://developer.android.com/reference/android/widget/AdapterView.html#setOnItemClickListener(android.widget.AdapterView.OnItemClickListener)` |   |

### setOnItemSelectedListener

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setOnItemSelectedListener(
    selectedListener: AdapterView.OnItemSelectedListener?
): Unit
```

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

| Parameters |
|---|---|
| `selectedListener: https://developer.android.com/reference/android/widget/AdapterView.OnItemSelectedListener.html?` | Listener to register. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/widget/AdapterView.html#setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener)` |   |

### setPromptPosition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setPromptPosition(position: Int): Unit
```

Set where the optional prompt view should appear. The default is `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#POSITION_PROMPT_ABOVE()`.

| Parameters |
|---|---|
| `position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | A position constant declaring where the prompt should be displayed. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#POSITION_PROMPT_ABOVE()` |   |
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#POSITION_PROMPT_BELOW()` |   |

### setPromptView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setPromptView(prompt: View?): Unit
```

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

| Parameters |
|---|---|
| `prompt: https://developer.android.com/reference/android/view/View.html?` | View to use as an informational prompt. |

### setSelection

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setSelection(position: Int): Unit
```

Set the selected position of the list. Only valid when `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#isShowing()` == `true`.

| Parameters |
|---|---|
| `position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | List position to set as selected. |

### setSoftInputMode

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setSoftInputMode(mode: Int): Unit
```

Sets the operating mode for the soft input area.

| Parameters |
|---|---|
| `mode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The desired mode, see `https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#softInputMode` for the full list |

| See also |
|---|---|
| `https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#softInputMode` |   |
| `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#getSoftInputMode()` |   |

### setVerticalOffset

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setVerticalOffset(offset: Int): Unit
```

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

| Parameters |
|---|---|
| `offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The vertical offset of the popup from its anchor. |

### setWidth

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setWidth(width: Int): Unit
```

Sets the width of the popup window in pixels. Can also be `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#MATCH_PARENT()` or `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/ListPopupWindow#WRAP_CONTENT()`.

| Parameters |
|---|---|
| `width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Width of the popup window. |

### setWindowLayoutType

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun setWindowLayoutType(layoutType: Int): Unit
```

Set the layout type for this popup window.

See `https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#type` for possible values.

| Parameters |
|---|---|
| `layoutType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Layout type for this window. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#type` |   |

### show

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
fun show(): Unit
```

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