Add resistance to MotionEvent when scrolling upwards

  android, drag, kotlin, motionevent, pan

I am using MotionEvent.ACTION_MOVE to drag a view up or down on the y axis. The dragging works perfectly, however, I would like to add some ‘resistance’ when the drag is UP.

Here is my progress thus far.

MotionEvent.ACTION_DOWN -> {

    downYValue = event.y

    rightDY = viewToDrag!!.y - event.rawY
MotionEvent.ACTION_MOVE -> {

    val displacement = ((event.rawY) + rightDY)

    println("DISPLACEMENT $displacement")

    val currentY = event.y
    if (downYValue > currentY) {


When the view is dragged either up or down, the drag speed is the same as the finger speed.

I would like for the UPWARD drag to drag much slower than your finger speed. The closet I got was detecting "up".

How can I add resistance to the upward drag speed?

Source: Android Questions