Skip to content

Set custom view for my location button in google map

I am using the Google Maps Android API v2, and I need a way to change the view (icon, color, etc.) of “My Location” button.

now i can change the position of that but i need a way to do a full customization. can somebody help me please?



The location button is actually an ImageView. You should first retrieve the fragment view that is associated with the map:

SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()

Next, you should get location view reference from the fragment:

ImageView locationButton = (ImageView) mapFragment.getView().findViewById(2);

Then change it’s image to anything you want. e.g.


Hope it helps.