1

MapToolbar along with a marker is shown on map, when toolbar is clicked it redirects to google map. I want to disable this functionality.

enter image description here

map_view.xml

 <com.google.android.gms.maps.MapView
        xmlns:map="http://schemas.android.com/apk/res-auto"
        android:id="@+id/summary_mv_map"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="15dp"
        android:layout_marginTop="10dp"
        map:liteMode="true"/>

what I tried: added mapView.getUiSettings().setMapToolbarEnabled(false), but not able to resolve getUiSettings().setMapToolbarEnabled().

Note: Don't want to remove marker

musica
  • 1,373
  • 3
  • 15
  • 34
  • Try this: `googleMap.getUiSettings().setMapToolbarEnabled(false);` Refer [this](https://developers.google.com/android/reference/com/google/android/gms/maps/UiSettings.html#setMapToolbarEnabled(boolean)) for more information. – Ankita Shah May 04 '17 at 09:50
  • tried but this code is for GoogleMap and not for MapView – musica May 04 '17 at 10:06
  • `mapView.getMap()` returns the GoogleMap. – Ankita Shah May 04 '17 at 10:11
  • cannot resolve mapView.getMap() – musica May 04 '17 at 10:15
  • Possible duplicate of [How to hide "Navigation" and "GPS Pointer" buttons when I click the marker on the android google map](http://stackoverflow.com/questions/30430664/how-to-hide-navigation-and-gps-pointer-buttons-when-i-click-the-marker-on-th) – xomena May 07 '17 at 21:54
  • @xomena before saying duplicate could you please read the entire question and read line "what I tried..." – musica May 08 '17 at 05:24
  • Maybe you can post more Java code that demonstrates how this issue is different from another one. I can see that all replies repeat the same answer from the mentioned question. – xomena May 08 '17 at 10:34

4 Answers4

8

Get GoogleMap object via getMapAsync, after that disable toolbar

mapView.getMapAsync(new OnMapReadyCallback() {
    @Override
    public void onMapReady(GoogleMap googleMap) {
        googleMap.getUiSettings().setMapToolbarEnabled(false);
    }
});
Stas Parshin
  • 7,973
  • 3
  • 24
  • 43
1

Use below line to enable and disable Map toolbar

googleMap.getUiSettings().setMapToolbarEnabled(false);

by-default it is true, make it false.

Surender Kumar
  • 1,123
  • 8
  • 15
1
map.getMapAsync(new OnMapReadyCallback() {
    @Override
    public void onMapReady(GoogleMap googleMap) {
        googleMap.getUiSettings().setAllGesturesEnabled(false);
    }
});
DarthJDG
  • 16,511
  • 11
  • 49
  • 56
garry
  • 419
  • 5
  • 10
0
map.setOnMarkerClickListener(new OnMarkerClickListener() {
    @Override
    public boolean onMarkerClick(Marker marker) {
        return true;
    }
});
Sunisha Guptan
  • 1,555
  • 17
  • 44