# ViewDragHelper

# ViewDragHelper

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

*** ** * ** ***

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


```
class ViewDragHelper
```

<br />

*** ** * ** ***

ViewDragHelper is a utility class for writing custom ViewGroups. It offers a number of useful operations and state tracking for allowing a user to drag and reposition views within their parent ViewGroup.

## Summary

|                                                                                                                   ### Nested types                                                                                                                    |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `abstract class `[ViewDragHelper.Callback](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper.Callback) A Callback is used as a communication channel with the ViewDragHelper back to the parent view using it. |

|                                    ### Constants                                    |
|-------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [DIRECTION_ALL](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#DIRECTION_ALL())` = 3` Indicates that a check should occur along all axes                                                     |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [DIRECTION_HORIZONTAL](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#DIRECTION_HORIZONTAL())` = 1` Indicates that a check should occur along the horizontal axis                            |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [DIRECTION_VERTICAL](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#DIRECTION_VERTICAL())` = 2` Indicates that a check should occur along the vertical axis                                  |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [EDGE_ALL](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_ALL())` = 15` Edge flag set indicating all edges should be affected.                                                          |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [EDGE_BOTTOM](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_BOTTOM())` = 8` Edge flag indicating that the bottom edge should be affected.                                              |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [EDGE_LEFT](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_LEFT())` = 1` Edge flag indicating that the left edge should be affected.                                                    |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [EDGE_RIGHT](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_RIGHT())` = 2` Edge flag indicating that the right edge should be affected.                                                 |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [EDGE_TOP](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_TOP())` = 4` Edge flag indicating that the top edge should be affected.                                                       |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [INVALID_POINTER](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#INVALID_POINTER())` = -1` A null/invalid pointer ID.                                                                        |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [STATE_DRAGGING](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#STATE_DRAGGING())` = 1` A view is currently being dragged.                                                                   |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [STATE_IDLE](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#STATE_IDLE())` = 0` A view is not currently being dragged or animating as a result of a fling/snap.                              |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [STATE_SETTLING](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#STATE_SETTLING())` = 2` A view is currently settling into place as a result of a fling or predefined non-interactive motion. |

|                                                                     ### Public functions                                                                     |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                | [abort](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#abort())`()` [cancel](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#cancel()), but also abort all motion in progress and snap to the end of any animation.                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                | [cancel](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#cancel())`()` The result of a call to this method is equivalent to [processTouchEvent](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#processTouchEvent(android.view.MotionEvent)) receiving an ACTION_CANCEL event.                                                                                                                                                                                                                                                                                                                                                                                                    |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                | [captureChildView](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#captureChildView(android.view.View,int))`(childView: `[View](https://developer.android.com/reference/android/view/View.html)`, activePointerId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Capture a specific child view for dragging within the parent.                                                                                                                                                                                                                                                                                                                                                           |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                          | [checkTouchSlop](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#checkTouchSlop(int))`(directions: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Check if any pointer tracked in the current gesture has crossed the required slop threshold.                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                          | [checkTouchSlop](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#checkTouchSlop(int,int))`(directions: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, pointerId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Check if the specified pointer tracked in the current gesture has crossed the required slop threshold.                                                                                                                                                                                                                                                                                                                                    |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                          | [continueSettling](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#continueSettling(boolean))`(deferCallbacks: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Move the captured settling view by the appropriate amount for the current time.                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `java-static `[ViewDragHelper](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper)                                     | [create](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#create(android.view.ViewGroup,androidx.customview.widget.ViewDragHelper.Callback))`(forParent: `[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)`, cb: `[ViewDragHelper.Callback](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper.Callback)`)` Factory method to create a new ViewDragHelper.                                                                                                                                                                                                                                                                                            |
| `java-static `[ViewDragHelper](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper)                                     | [create](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#create(android.view.ViewGroup,float,androidx.customview.widget.ViewDragHelper.Callback))`(` ` forParent: `[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)`,` ` sensitivity: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`,` ` cb: `[ViewDragHelper.Callback](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper.Callback) `)` Factory method to create a new ViewDragHelper.                                                                                                                                                                           |
| [View](https://developer.android.com/reference/android/view/View.html)`?`                                                                                    | [findTopChildUnder](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#findTopChildUnder(int,int))`(x: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, y: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Find the topmost child under the given point within the parent view's coordinate system.                                                                                                                                                                                                                                                                                                                                                             |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                | [flingCapturedView](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#flingCapturedView(int,int,int,int))`(minLeft: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, minTop: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, maxLeft: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, maxTop: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Settle the captured view based on standard free-moving fling behavior.                                                                                                                                                                             |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                  | [getActivePointerId](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#getActivePointerId())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| [View](https://developer.android.com/reference/android/view/View.html)`?`                                                                                    | [getCapturedView](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#getCapturedView())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `@`[Px](https://developer.android.com/reference/kotlin/androidx/annotation/Px)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [getDefaultEdgeSize](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#getDefaultEdgeSize())`()` Return the default size used for edge tracking.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `@`[Px](https://developer.android.com/reference/kotlin/androidx/annotation/Px)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [getEdgeSize](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#getEdgeSize())`()` Return the size of an edge.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)                                                                              | [getMinVelocity](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#getMinVelocity())`()` Return the currently configured minimum velocity.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `@`[Px](https://developer.android.com/reference/kotlin/androidx/annotation/Px)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [getTouchSlop](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#getTouchSlop())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                  | [getViewDragState](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#getViewDragState())`()` Retrieve the current drag state of this helper.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                          | [isCapturedViewUnder](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#isCapturedViewUnder(int,int))`(x: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, y: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Determine if the currently captured view is under the given point in the parent view's coordinate system.                                                                                                                                                                                                                                                                                                                                        |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                          | [isEdgeTouched](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#isEdgeTouched(int))`(edges: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Check if any of the edges specified were initially touched in the currently active gesture.                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                          | [isEdgeTouched](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#isEdgeTouched(int,int))`(edges: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, pointerId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Check if any of the edges specified were initially touched by the pointer with the specified ID.                                                                                                                                                                                                                                                                                                                                                 |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                          | [isPointerDown](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#isPointerDown(int))`(pointerId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Check if the given pointer ID represents a pointer that is currently down (to the best of the ViewDragHelper's knowledge).                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                          | [isViewUnder](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#isViewUnder(android.view.View,int,int))`(view: `[View](https://developer.android.com/reference/android/view/View.html)`?, x: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, y: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Determine if the supplied view is under the given point in the parent view's coordinate system.                                                                                                                                                                                                                                                               |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                | [processTouchEvent](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#processTouchEvent(android.view.MotionEvent))`(ev: `[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent.html)`)` Process a touch event received by the parent view.                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                | [setEdgeSize](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#setEdgeSize(int))`(size: @`[Px](https://developer.android.com/reference/kotlin/androidx/annotation/Px)` @`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Set the range in pixels along the edges of this view that will actively detect edge touches or drags if edge tracking is enabled.                                                                                                                                                                                                                               |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                | [setEdgeTrackingEnabled](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#setEdgeTrackingEnabled(int))`(edgeFlags: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Enable edge tracking for the selected edges of the parent view.                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                | [setMinVelocity](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#setMinVelocity(float))`(minVel: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Set the minimum velocity that will be detected as having a magnitude greater than zero in pixels per second.                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                          | [settleCapturedViewAt](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#settleCapturedViewAt(int,int))`(finalLeft: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, finalTop: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Settle the captured view at the given (left, top) position.                                                                                                                                                                                                                                                                                                                                                                     |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                          | [shouldInterceptTouchEvent](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#shouldInterceptTouchEvent(android.view.MotionEvent))`(ev: `[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent.html)`)` Check if this event as provided to the parent view's onInterceptTouchEvent should cause the parent to intercept the touch event stream.                                                                                                                                                                                                                                                                                                                                                     |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                          | [smoothSlideViewTo](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#smoothSlideViewTo(android.view.View,int,int))`(child: `[View](https://developer.android.com/reference/android/view/View.html)`, finalLeft: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, finalTop: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Animate the view `child` to the given (left, top) position.                                                                                                                                                                                                                                                                        |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                          | [smoothSlideViewTo](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#smoothSlideViewTo(android.view.View,int,int,int,android.view.animation.Interpolator))`(` ` child: `[View](https://developer.android.com/reference/android/view/View.html)`,` ` finalLeft: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` finalTop: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` duration: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` interpolator: `[Interpolator](https://developer.android.com/reference/android/view/animation/Interpolator.html)`?` `)` Animate the view `child` to the given (left, top) position. |

|                               ### Protected functions                               |
|-------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [canScroll](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#canScroll(android.view.View,boolean,int,int,int,int))`(v: `[View](https://developer.android.com/reference/android/view/View.html)`, checkV: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`, dx: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, dy: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, x: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, y: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Tests scrollability within child views of v given a delta of dx. |

## Constants

### DIRECTION_ALL

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

```
const val DIRECTION_ALL = 3: Int
```

Indicates that a check should occur along all axes  

### DIRECTION_HORIZONTAL

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

```
const val DIRECTION_HORIZONTAL = 1: Int
```

Indicates that a check should occur along the horizontal axis  

### DIRECTION_VERTICAL

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

```
const val DIRECTION_VERTICAL = 2: Int
```

Indicates that a check should occur along the vertical axis  

### EDGE_ALL

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

```
const val EDGE_ALL = 15: Int
```

Edge flag set indicating all edges should be affected.  

### EDGE_BOTTOM

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

```
const val EDGE_BOTTOM = 8: Int
```

Edge flag indicating that the bottom edge should be affected.  

### EDGE_LEFT

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

```
const val EDGE_LEFT = 1: Int
```

Edge flag indicating that the left edge should be affected.  

### EDGE_RIGHT

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

```
const val EDGE_RIGHT = 2: Int
```

Edge flag indicating that the right edge should be affected.  

### EDGE_TOP

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

```
const val EDGE_TOP = 4: Int
```

Edge flag indicating that the top edge should be affected.  

### INVALID_POINTER

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

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

A null/invalid pointer ID.  

### STATE_DRAGGING

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

```
const val STATE_DRAGGING = 1: Int
```

A view is currently being dragged. The position is currently changing as a result of user input or simulated user input.  

### STATE_IDLE

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

```
const val STATE_IDLE = 0: Int
```

A view is not currently being dragged or animating as a result of a fling/snap.  

### STATE_SETTLING

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

```
const val STATE_SETTLING = 2: Int
```

A view is currently settling into place as a result of a fling or predefined non-interactive motion.  

## Public functions

### abort

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

```
fun abort(): Unit
```

[cancel](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#cancel()), but also abort all motion in progress and snap to the end of any animation.  

### cancel

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

```
fun cancel(): Unit
```

The result of a call to this method is equivalent to [processTouchEvent](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#processTouchEvent(android.view.MotionEvent)) receiving an ACTION_CANCEL event.  

### captureChildView

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

```
fun captureChildView(childView: View, activePointerId: Int): Unit
```

Capture a specific child view for dragging within the parent. The callback will be notified but [tryCaptureView](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper.Callback#tryCaptureView(android.view.View,int)) will not be asked permission to capture this view.  

|                                           Parameters                                           |
|------------------------------------------------------------------------------------------------|------------------------------------------------------------|
| `childView: `[View](https://developer.android.com/reference/android/view/View.html)            | Child view to capture                                      |
| `activePointerId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | ID of the pointer that is dragging the captured child view |

### checkTouchSlop

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

```
fun checkTouchSlop(directions: Int): Boolean
```

Check if any pointer tracked in the current gesture has crossed the required slop threshold.

This depends on internal state populated by [shouldInterceptTouchEvent](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#shouldInterceptTouchEvent(android.view.MotionEvent)) or [processTouchEvent](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#processTouchEvent(android.view.MotionEvent)). You should only rely on the results of this method after all currently available touch data has been provided to one of these two methods.  

|                                        Parameters                                         |
|-------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `directions: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Combination of direction flags, see [DIRECTION_HORIZONTAL](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#DIRECTION_HORIZONTAL()), [DIRECTION_VERTICAL](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#DIRECTION_VERTICAL()), [DIRECTION_ALL](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#DIRECTION_ALL()) |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|--------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if the slop threshold has been crossed, false otherwise |

### checkTouchSlop

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

```
fun checkTouchSlop(directions: Int, pointerId: Int): Boolean
```

Check if the specified pointer tracked in the current gesture has crossed the required slop threshold.

This depends on internal state populated by [shouldInterceptTouchEvent](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#shouldInterceptTouchEvent(android.view.MotionEvent)) or [processTouchEvent](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#processTouchEvent(android.view.MotionEvent)). You should only rely on the results of this method after all currently available touch data has been provided to one of these two methods.  

|                                        Parameters                                         |
|-------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `directions: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Combination of direction flags, see [DIRECTION_HORIZONTAL](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#DIRECTION_HORIZONTAL()), [DIRECTION_VERTICAL](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#DIRECTION_VERTICAL()), [DIRECTION_ALL](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#DIRECTION_ALL()) |
| `pointerId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)  | ID of the pointer to slop check as specified by MotionEvent                                                                                                                                                                                                                                                                                                                                                                                 |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|--------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if the slop threshold has been crossed, false otherwise |

### continueSettling

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

```
fun continueSettling(deferCallbacks: Boolean): Boolean
```

Move the captured settling view by the appropriate amount for the current time. If `continueSettling` returns true, the caller should call it again on the next frame to continue.  

|                                              Parameters                                               |
|-------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `deferCallbacks: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if state callbacks should be deferred via posted message. Set this to true if you are calling this method from [computeScroll](https://developer.android.com/reference/android/view/View.html#computeScroll()) or similar methods invoked as part of layout or drawing. |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if settle is still in progress |

### create

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

```
java-static fun create(forParent: ViewGroup, cb: ViewDragHelper.Callback): ViewDragHelper
```

Factory method to create a new ViewDragHelper.  

|                                                             Parameters                                                             |
|------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------|
| `forParent: `[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)                                      | Parent view to monitor                             |
| `cb: `[ViewDragHelper.Callback](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper.Callback) | Callback to provide information and receive events |

|                                                  Returns                                                   |
|------------------------------------------------------------------------------------------------------------|-------------------------------|
| [ViewDragHelper](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper) | a new ViewDragHelper instance |

### create

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

```
java-static fun create(
    forParent: ViewGroup,
    sensitivity: Float,
    cb: ViewDragHelper.Callback
): ViewDragHelper
```

Factory method to create a new ViewDragHelper.  

|                                                             Parameters                                                             |
|------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
| `forParent: `[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)                                      | Parent view to monitor                                                                                                                   |
| `sensitivity: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)                                     | Multiplier for how sensitive the helper should be about detecting the start of a drag. Larger values are more sensitive. 1.0f is normal. |
| `cb: `[ViewDragHelper.Callback](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper.Callback) | Callback to provide information and receive events                                                                                       |

|                                                  Returns                                                   |
|------------------------------------------------------------------------------------------------------------|-------------------------------|
| [ViewDragHelper](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper) | a new ViewDragHelper instance |

### findTopChildUnder

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

```
fun findTopChildUnder(x: Int, y: Int): View?
```

Find the topmost child under the given point within the parent view's coordinate system. The child order is determined using [getOrderedChildIndex](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper.Callback#getOrderedChildIndex(int)).  

|                                    Parameters                                    |
|----------------------------------------------------------------------------------|------------------------------------------------------|
| `x: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | X position to test in the parent's coordinate system |
| `y: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Y position to test in the parent's coordinate system |

|                                  Returns                                  |
|---------------------------------------------------------------------------|------------------------------------------------------------|
| [View](https://developer.android.com/reference/android/view/View.html)`?` | The topmost child view under (x, y) or null if none found. |

### flingCapturedView

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

```
fun flingCapturedView(minLeft: Int, minTop: Int, maxLeft: Int, maxTop: Int): Unit
```

Settle the captured view based on standard free-moving fling behavior. The caller should invoke [continueSettling](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#continueSettling(boolean)) on each subsequent frame to continue the motion until it returns false.  

|                                       Parameters                                       |
|----------------------------------------------------------------------------------------|---------------------------------------------|
| `minLeft: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Minimum X position for the view's left edge |
| `minTop: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)  | Minimum Y position for the view's top edge  |
| `maxLeft: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Maximum X position for the view's left edge |
| `maxTop: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)  | Maximum Y position for the view's top edge  |

### getActivePointerId

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

```
fun getActivePointerId(): Int
```  

|                                   Returns                                   |
|-----------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The ID of the pointer currently dragging the captured view, or [INVALID_POINTER](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#INVALID_POINTER()). |

### getCapturedView

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

```
fun getCapturedView(): View?
```  

|                                  Returns                                  |
|---------------------------------------------------------------------------|--------------------------------------------------------------------|
| [View](https://developer.android.com/reference/android/view/View.html)`?` | The currently captured view, or null if no view has been captured. |

### getDefaultEdgeSize

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

```
fun getDefaultEdgeSize(): @Px Int
```

Return the default size used for edge tracking.  

|                                                                           Returns                                                                            |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------|
| `@`[Px](https://developer.android.com/reference/kotlin/androidx/annotation/Px)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The default edge size |

|                                                                    See also                                                                    |
|------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setEdgeTrackingEnabled](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#setEdgeTrackingEnabled(int)) |   |
| [getEdgeSize](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#getEdgeSize())                          |   |

### getEdgeSize

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

```
fun getEdgeSize(): @Px Int
```

Return the size of an edge. This is the range in pixels along the edges of this view that will actively detect edge touches or drags if edge tracking is enabled.  

|                                                                           Returns                                                                            |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------|
| `@`[Px](https://developer.android.com/reference/kotlin/androidx/annotation/Px)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The size of an edge in pixels |

|                                                                    See also                                                                    |
|------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setEdgeTrackingEnabled](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#setEdgeTrackingEnabled(int)) |   |

### getMinVelocity

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

```
fun getMinVelocity(): Float
```

Return the currently configured minimum velocity. Any flings with a magnitude less than this value in pixels per second. Callback methods accepting a velocity will receive zero as a velocity value if the real detected velocity was below this threshold.  

|                                     Returns                                     |
|---------------------------------------------------------------------------------|--------------------------------------------|
| [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | the minimum velocity that will be detected |

### getTouchSlop

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

```
fun getTouchSlop(): @Px Int
```  

|                                                                           Returns                                                                            |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|
| `@`[Px](https://developer.android.com/reference/kotlin/androidx/annotation/Px)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The minimum distance in pixels that the user must travel to initiate a drag |

### getViewDragState

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

```
fun getViewDragState(): Int
```

Retrieve the current drag state of this helper. This will return one of [STATE_IDLE](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#STATE_IDLE()), [STATE_DRAGGING](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#STATE_DRAGGING()) or [STATE_SETTLING](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#STATE_SETTLING()).  

|                                   Returns                                   |
|-----------------------------------------------------------------------------|------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The current drag state |

### isCapturedViewUnder

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

```
fun isCapturedViewUnder(x: Int, y: Int): Boolean
```

Determine if the currently captured view is under the given point in the parent view's coordinate system. If there is no captured view this method will return false.  

|                                    Parameters                                    |
|----------------------------------------------------------------------------------|------------------------------------------------------|
| `x: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | X position to test in the parent's coordinate system |
| `y: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Y position to test in the parent's coordinate system |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|---------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if the captured view is under the given point, false otherwise |

### isEdgeTouched

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

```
fun isEdgeTouched(edges: Int): Boolean
```

Check if any of the edges specified were initially touched in the currently active gesture. If there is no currently active gesture this method will return false.  

|                                      Parameters                                      |
|--------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `edges: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Edges to check for an initial edge touch. See [EDGE_LEFT](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_LEFT()), [EDGE_TOP](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_TOP()), [EDGE_RIGHT](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_RIGHT()), [EDGE_BOTTOM](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_BOTTOM()) and [EDGE_ALL](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_ALL()) |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if any of the edges specified were initially touched in the current gesture |

### isEdgeTouched

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

```
fun isEdgeTouched(edges: Int, pointerId: Int): Boolean
```

Check if any of the edges specified were initially touched by the pointer with the specified ID. If there is no currently active gesture or if there is no pointer with the given ID currently down this method will return false.  

|                                        Parameters                                        |
|------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `edges: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)     | Edges to check for an initial edge touch. See [EDGE_LEFT](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_LEFT()), [EDGE_TOP](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_TOP()), [EDGE_RIGHT](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_RIGHT()), [EDGE_BOTTOM](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_BOTTOM()) and [EDGE_ALL](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_ALL()) |
| `pointerId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The pointer that will be checked; returns false if there is no such pointer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if any of the edges specified were initially touched in the current gesture |

### isPointerDown

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

```
fun isPointerDown(pointerId: Int): Boolean
```

Check if the given pointer ID represents a pointer that is currently down (to the best of the ViewDragHelper's knowledge).

The state used to report this information is populated by the methods [shouldInterceptTouchEvent](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#shouldInterceptTouchEvent(android.view.MotionEvent)) or [processTouchEvent](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#processTouchEvent(android.view.MotionEvent)). If one of these methods has not been called for all relevant MotionEvents to track, the information reported by this method may be stale or incorrect.  

|                                        Parameters                                        |
|------------------------------------------------------------------------------------------|-----------------------------------------------------------------|
| `pointerId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | pointer ID to check; corresponds to IDs provided by MotionEvent |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-----------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if the pointer with the given ID is still down |

### isViewUnder

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

```
fun isViewUnder(view: View?, x: Int, y: Int): Boolean
```

Determine if the supplied view is under the given point in the parent view's coordinate system.  

|                                    Parameters                                     |
|-----------------------------------------------------------------------------------|------------------------------------------------------|
| `view: `[View](https://developer.android.com/reference/android/view/View.html)`?` | Child view of the parent to hit test                 |
| `x: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)  | X position to test in the parent's coordinate system |
| `y: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)  | Y position to test in the parent's coordinate system |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|---------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if the supplied view is under the given point, false otherwise |

### processTouchEvent

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

```
fun processTouchEvent(ev: MotionEvent): Unit
```

Process a touch event received by the parent view. This method will dispatch callback events as needed before returning. The parent view's onTouchEvent implementation should call this.  

|                                         Parameters                                         |
|--------------------------------------------------------------------------------------------|---------------------------------------------|
| `ev: `[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent.html) | The touch event received by the parent view |

### setEdgeSize

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

```
fun setEdgeSize(size: @Px @IntRange(from = 0) Int): Unit
```

Set the range in pixels along the edges of this view that will actively detect edge touches or drags if edge tracking is enabled.  

|                                                                                                                               Parameters                                                                                                                                |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------|
| `size: @`[Px](https://developer.android.com/reference/kotlin/androidx/annotation/Px)` @`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Edge size in pixels |

|                                                                    See also                                                                    |
|------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setEdgeTrackingEnabled](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#setEdgeTrackingEnabled(int)) |   |
| [getEdgeSize](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#getEdgeSize())                          |   |

### setEdgeTrackingEnabled

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

```
fun setEdgeTrackingEnabled(edgeFlags: Int): Unit
```

Enable edge tracking for the selected edges of the parent view. The callback's [onEdgeTouched](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper.Callback#onEdgeTouched(int,int)) and [onEdgeDragStarted](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper.Callback#onEdgeDragStarted(int,int)) methods will only be invoked for edges for which edge tracking has been enabled.  

|                                        Parameters                                        |
|------------------------------------------------------------------------------------------|---------------------------------------------------------|
| `edgeFlags: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Combination of edge flags describing the edges to watch |

|                                                       See also                                                        |
|-----------------------------------------------------------------------------------------------------------------------|---|
| [EDGE_LEFT](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_LEFT())     |   |
| [EDGE_TOP](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_TOP())       |   |
| [EDGE_RIGHT](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_RIGHT())   |   |
| [EDGE_BOTTOM](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#EDGE_BOTTOM()) |   |

### setMinVelocity

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

```
fun setMinVelocity(minVel: Float): Unit
```

Set the minimum velocity that will be detected as having a magnitude greater than zero in pixels per second. Callback methods accepting a velocity will be clamped appropriately.  

|                                        Parameters                                         |
|-------------------------------------------------------------------------------------------|----------------------------|
| `minVel: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | Minimum velocity to detect |

### settleCapturedViewAt

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

```
fun settleCapturedViewAt(finalLeft: Int, finalTop: Int): Boolean
```

Settle the captured view at the given (left, top) position. The appropriate velocity from prior motion will be taken into account. If this method returns true, the caller should invoke [continueSettling](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#continueSettling(boolean)) on each subsequent frame to continue the motion until it returns false. If this method returns false there is no further work to do to complete the movement.  

|                                        Parameters                                        |
|------------------------------------------------------------------------------------------|--------------------------------------------------|
| `finalLeft: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Settled left edge position for the captured view |
| `finalTop: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)  | Settled top edge position for the captured view  |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if animation should continue through [continueSettling](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#continueSettling(boolean)) calls |

### shouldInterceptTouchEvent

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

```
fun shouldInterceptTouchEvent(ev: MotionEvent): Boolean
```

Check if this event as provided to the parent view's onInterceptTouchEvent should cause the parent to intercept the touch event stream.  

|                                         Parameters                                         |
|--------------------------------------------------------------------------------------------|-----------------------------------------------|
| `ev: `[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent.html) | MotionEvent provided to onInterceptTouchEvent |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-----------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if the parent view should return true from onInterceptTouchEvent |

### smoothSlideViewTo

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

```
fun smoothSlideViewTo(child: View, finalLeft: Int, finalTop: Int): Boolean
```

Animate the view `child` to the given (left, top) position. If this method returns true, the caller should invoke [continueSettling](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#continueSettling(boolean)) on each subsequent frame to continue the motion until it returns false. If this method returns false there is no further work to do to complete the movement.

This operation does not count as a capture event, though [getCapturedView](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#getCapturedView()) will still report the sliding view while the slide is in progress.  

|                                        Parameters                                        |
|------------------------------------------------------------------------------------------|-----------------------------------|
| `child: `[View](https://developer.android.com/reference/android/view/View.html)          | Child view to capture and animate |
| `finalLeft: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Final left position of child      |
| `finalTop: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)  | Final top position of child       |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if animation should continue through [continueSettling](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#continueSettling(boolean)) calls |

### smoothSlideViewTo

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

```
fun smoothSlideViewTo(
    child: View,
    finalLeft: Int,
    finalTop: Int,
    duration: Int,
    interpolator: Interpolator?
): Boolean
```

Animate the view `child` to the given (left, top) position. If this method returns true, the caller should invoke [continueSettling](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#continueSettling(boolean)) on each subsequent frame to continue the motion until it returns false. If this method returns false there is no further work to do to complete the movement.

This operation does not count as a capture event, though [getCapturedView](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#getCapturedView()) will still report the sliding view while the slide is in progress.  

|                                                     Parameters                                                      |
|---------------------------------------------------------------------------------------------------------------------|-------------------------------------------|
| `child: `[View](https://developer.android.com/reference/android/view/View.html)                                     | Child view to capture and animate         |
| `finalLeft: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                            | Final left position of child              |
| `finalTop: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                             | Final top position of child               |
| `duration: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                             | The time duration for the animation.      |
| `interpolator: `[Interpolator](https://developer.android.com/reference/android/view/animation/Interpolator.html)`?` | The interpolator used for this animation. |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if animation should continue through [continueSettling](https://developer.android.com/reference/kotlin/androidx/customview/widget/ViewDragHelper#continueSettling(boolean)) calls |

## Protected functions

### canScroll

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

```
protected fun canScroll(v: View, checkV: Boolean, dx: Int, dy: Int, x: Int, y: Int): Boolean
```

Tests scrollability within child views of v given a delta of dx.  

|                                          Parameters                                           |
|-----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| `v: `[View](https://developer.android.com/reference/android/view/View.html)                   | View to test for horizontal scrollability                                                                  |
| `checkV: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Whether the view v passed should itself be checked for scrollability (true), or just its children (false). |
| `dx: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)             | Delta scrolled in pixels along the X axis                                                                  |
| `dy: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)             | Delta scrolled in pixels along the Y axis                                                                  |
| `x: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)              | X coordinate of the active touch point                                                                     |
| `y: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)              | Y coordinate of the active touch point                                                                     |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|----------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if child views of v can be scrolled by delta of dx. |