# ListPopupWindowCompat

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

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/androidx/core/widget/ListPopupWindowCompat "View this page in Java")


```
class ListPopupWindowCompat
```

<br />

*** ** * ** ***

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

## Summary

| ### Public functions |
|---|---|
| `java-static `[View.OnTouchListener](https://developer.android.com/reference/android/view/View.OnTouchListener.html)`!` | ~~[createDragToOpenListener](https://developer.android.com/reference/kotlin/androidx/core/widget/ListPopupWindowCompat#createDragToOpenListener(java.lang.Object,android.view.View))~~`(listPopupWindow: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`!, src: `[View](https://developer.android.com/reference/android/view/View.html)`!)` **This function is deprecated.** Use [createDragToOpenListener](https://developer.android.com/reference/kotlin/androidx/core/widget/ListPopupWindowCompat#createDragToOpenListener(android.widget.ListPopupWindow,android.view.View)) that takes in [ListPopupWindow](https://developer.android.com/reference/android/widget/ListPopupWindow.html) instead of [Object](https://developer.android.com/reference/java/lang/Object.html). <br /> |
| `java-static `[View.OnTouchListener](https://developer.android.com/reference/android/view/View.OnTouchListener.html)`?` | `@`[ReplaceWith](https://developer.android.com/reference/kotlin/androidx/annotation/ReplaceWith)`(expression = "listPopupWindow.createDragToOpenListener(src)")` ~~[createDragToOpenListener](https://developer.android.com/reference/kotlin/androidx/core/widget/ListPopupWindowCompat#createDragToOpenListener(android.widget.ListPopupWindow,android.view.View))~~`(listPopupWindow: `[ListPopupWindow](https://developer.android.com/reference/android/widget/ListPopupWindow.html)`, src: `[View](https://developer.android.com/reference/android/view/View.html)`)` **This function is deprecated.** Call createDragToOpenListener directly. <br /> |

## Public functions

### createDragToOpenListener

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

```
java-static fun [createDragToOpenListener](https://developer.android.com/reference/kotlin/androidx/core/widget/ListPopupWindowCompat#createDragToOpenListener(java.lang.Object,android.view.View))(listPopupWindow: Any!, src: View!): View.OnTouchListener!
```
| **This function is deprecated.**   
|
| Use [createDragToOpenListener](https://developer.android.com/reference/kotlin/androidx/core/widget/ListPopupWindowCompat#createDragToOpenListener(android.widget.ListPopupWindow,android.view.View)) that takes in [ListPopupWindow](https://developer.android.com/reference/android/widget/ListPopupWindow.html) instead of [Object](https://developer.android.com/reference/java/lang/Object.html).

Returns an [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 ListPopupWindow.setAnchorView(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 |
|---|---|
| `listPopupWindow: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`!` | the ListPopupWindow against which to invoke the method |
| `src: `[View](https://developer.android.com/reference/android/view/View.html)`!` | the view on which the resulting listener will be set |

| Returns |
|---|---|
| [View.OnTouchListener](https://developer.android.com/reference/android/view/View.OnTouchListener.html)`!` | a touch listener that controls drag-to-open behavior, or `null` on unsupported APIs |

### createDragToOpenListener

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

```
@ReplaceWith(expression = "listPopupWindow.createDragToOpenListener(src)")
java-static fun [createDragToOpenListener](https://developer.android.com/reference/kotlin/androidx/core/widget/ListPopupWindowCompat#createDragToOpenListener(android.widget.ListPopupWindow,android.view.View))(listPopupWindow: ListPopupWindow, src: View): View.OnTouchListener?
```
| **This function is deprecated.**   
|
| Call createDragToOpenListener directly.

Returns an [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 ListPopupWindow.setAnchorView(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 |
|---|---|
| `listPopupWindow: `[ListPopupWindow](https://developer.android.com/reference/android/widget/ListPopupWindow.html) | the ListPopupWindow against which to invoke the method |
| `src: `[View](https://developer.android.com/reference/android/view/View.html) | the view on which the resulting listener will be set |

| Returns |
|---|---|
| [View.OnTouchListener](https://developer.android.com/reference/android/view/View.OnTouchListener.html)`?` | a touch listener that controls drag-to-open behavior, or `null` on unsupported APIs |