recyclerView.addOnItemTouchListener(object:RecyclerView.OnItemTouchListener{
override fun onInterceptTouchEvent(rv: RecyclerView, e: MotionEvent): Boolean {
return firstItemVisible(rv) && mGestureDetector?.onTouchEvent(e) == true
}
override fun onTouchEvent(rv: RecyclerView, e: MotionEvent) {
}
override fun onRequestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {
}
private fun firstItemVisible(rv: RecyclerView): Boolean {
return (rv.layoutManager as? LinearLayoutManager)?.findFirstCompletelyVisibleItemPosition() ?: -1 == 0
}
})
Bottom to up full width ImageView

private var mGestureDetector: GestureDetector? = null
private fun handleOnSwipeDown() {
mGestureDetector =
GestureDetector(this, object : GestureDetector.SimpleOnGestureListener() {
override fun onFling(
e1: MotionEvent,
e2: MotionEvent,
velocityX: Float,
velocityY: Float
): Boolean {
if (abs(velocityY) < 100) {
return false
}
if (e2.rawY - e1.rawY > 200) {
finish()
return true
}
return if (e1.rawY - e2.rawY > 200) {
false
} else {
super.onFling(e1, e2, velocityX, velocityY)
}
}
})
}
override fun onTouchEvent(event: MotionEvent?): Boolean {
mGestureDetector?.onTouchEvent(event)
Log.d("onTouchEvente"," "+event?.x +" "+event?.y)
return super.onTouchEvent(event)
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rootView"
android:background="@color/white"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/splashAnim"
android:layout_width="match_parent"
android:layout_height="200dp"
app:lottie_autoPlay="false"
android:layout_gravity="center"
app:lottie_loop="false" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom|center"
android:gravity="bottom"
android:layout_weight="1">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/splashImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY" />
</LinearLayout>
</LinearLayout>