This is how I've solved this -
I've created a custom view extending mapView and override dispatchTouchEvent()
class CustomMapView(context: Context, attrs: AttributeSet?): MapView(context, attrs) {
override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
this.performClick()
when (ev.action) {
MotionEvent.ACTION_DOWN -> // Disallow ScrollView to intercept touch events.
this.parent.requestDisallowInterceptTouchEvent(true)
MotionEvent.ACTION_UP -> // Allow ScrollView to intercept touch events.
this.parent.requestDisallowInterceptTouchEvent(false)
}
// Handle MapView's touch events.
super.dispatchTouchEvent(ev)
return true
}
}
and used this to my xml -
<com.demo.android.demo.ui.base.customviews.CustomMapView
android:id="@+id/map_placeholder"
android:layout_width="0dp"
android:layout_height="700dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
map:mapType="none" />