Android Google map version-2 show direction and Google map icon
Asked Answered
C

4

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?

Cave answered 25/3, 2015 at 11:57 Comment(1)
You have to set setMapToolbarEnabled to false refer this linkEncasement
E
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).

Explicit answered 25/3, 2015 at 12:58 Comment(4)
Thanks it is working. please explain me how the return true of OnMarkerClickListener hide the options?Cave
One important problem occurred by that solution. if I implement OnMarkerClickListener with return true custom info window does not open. please check.Cave
yeah, you have to do it by yourselfClinkstone
How do you open the info window if you are returning true?Ogawa
F
25

Google Map provides a simple boolean method for this:

gmap.getUiSettings().setMapToolbarEnabled(false);

And You are done.

Flanders answered 11/8, 2015 at 8:1 Comment(0)
E
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).

Explicit answered 25/3, 2015 at 12:58 Comment(4)
Thanks it is working. please explain me how the return true of OnMarkerClickListener hide the options?Cave
One important problem occurred by that solution. if I implement OnMarkerClickListener with return true custom info window does not open. please check.Cave
yeah, you have to do it by yourselfClinkstone
How do you open the info window if you are returning true?Ogawa
K
3
     @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);
    }
Kirov answered 19/1, 2018 at 7:27 Comment(0)
A
0

It's Called Map toolbar

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

Ancient answered 3/6, 2017 at 17:8 Comment(1)
This is just a very short version of an older answer and does not contribute to answering the question.Pistoleer

© 2022 - 2024 — McMap. All rights reserved.