I\'m just starting to play with MotionLayout
. I have defined an activity layout using MotionLayout
that uses a MotionScene
to hide and sh
Here is simple solution:
Just add this fun:
@SuppressLint("ClickableViewAccessibility")
fun View.setOnClick(clickEvent: () -> Unit) {
this.setOnTouchListener { _, event ->
if (event.action == MotionEvent.ACTION_UP) {
clickEvent.invoke()
}
false
}
}
This is how you use it:
nextButton.setOnClick {
//Do something
}