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?
Advertisement
Answer
The location button is actually an ImageView. You should first retrieve the fragment view that is associated with the map:
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map);
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.
locationButton.setImageResource(R.drawable.icon_location);
Hope it helps.