I have a Recyclerview and a Custom view inside one RelativeLayout like that image
My custom view has On Touch listener for it with the following code
override fun onTouch(view: View?, e: MotionEvent?): Boolean {
when (e!!.action) {
MotionEvent.ACTION_DOWN -> {
_isMouseCaptured = true
bubbleFR.visibility = VISIBLE
getTouchedItem(e.y)
return true
}
MotionEvent.ACTION_UP -> {
_isMouseCaptured = false
hideBubble()
}
MotionEvent.ACTION_MOVE -> {
_isMouseCaptured = true
getTouchedItem(e.y)
}
// MotionEvent.ACTION_CANCEL -> {
//
// }
}
// lineLL1.performClick()
return true
}
But a non expecting behavior occurred like following:
So. I can hold and capture mouse move for my custom view (like dragging) only when I started it while the recyclerview is scrolling, otherwise it is not working. It is like some other view steals the focus of my custom view I want to touch my custom view and move my finger on it normally like swiping my custom view.
I solved my problem by using drag drop technique.