9

In my Android application my map screen shows direction and Google map when click marker on the map. I use the following in my application.

XML:

<fragment
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.MapFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

In code:

GoogleMap googleMap = ((MapFragment) getFragmentManager().findFragmentById(
        R.id.map)).getMap();

I have marked the direction and Google map icon marked in blue color. please see the image of my map screen.

enter image description here

How to hide direction and Google map icon from map fragment?

M.A.Murali
  • 9,988
  • 36
  • 105
  • 182
  • You have to set setMapToolbarEnabled to false refer this [link](http://stackoverflow.com/questions/27690711/display-toolbar-for-google-maps-marker-automatically/38743138#38743138) – Naveen Kumar M Aug 03 '16 at 12:06

4 Answers4

25

Google Map provides a simple boolean method for this:

gmap.getUiSettings().setMapToolbarEnabled(false);

And You are done.

Sagar Shah
  • 4,272
  • 2
  • 25
  • 36
7

TL;DR version:

Try overriding OnMarkerClickListener and return true.


Longer version:

When you return true you say to GoogleMap

I, the developer, handled a click on the Marker. You, the GoogleMap, don't have to do anything.

So as a result GoogleMap does not perform its default action which in this case would be: show those buttons (which you don't want).

Marian Paździoch
  • 8,813
  • 10
  • 58
  • 103
2
     @Override
        public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
            // for Map tool disable
    mMap.getUiSettings().setMapToolbarEnabled(false);

           // for Zoom Button Enable on Google Map
mMap.getUiSettings().setZoomControlsEnabled(true);

          //for Location  Button enable on Google Map
        mMap.getUiSettings().setMyLocationButtonEnabled(true);
    }
0

It's Called Map toolbar

You can enable and disable the toolbar by calling UiSettings.setMapToolbarEnabled(boolean).

Optional
  • 21
  • 1
  • 1
    This is just a very short version of an older answer and does not contribute to answering the question. – ophychius Jun 03 '17 at 17:45