Setup:
In a google maps integration for android, the screen is occupied by MapView and there's an ImageView in the centre of the screen being used as the marker.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.gms.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/global_dimen_6_dp"
android:contentDescription="@string/app_name"
app:srcCompat="@drawable/ic_location_marker" />
</FrameLayout>
Requirement:
By default, the Google Maps on android zooms as well scrolls when we do pinch zoom on the map. Due to this, the marker in centre moves when the map is zoomed. In apps like Uber and Ola, on pinch zoom, the zoom takes places about the centre of the map where the location marker is present, it doesn't scroll and hence the marker does not move on zooming.
Attempt:
To implement the same, I referred this stackoverflow link and found this flag called isScrollGesturesEnabledDuringRotateOrZoom and set its value to false with the expectation that on zooming map now, the map wouldn't scroll and marker wouldn't move but it did not work.
Query:
Is there some other way to achieve the same ?