Relocate Google logo in MapView
Google Maps SDK v2 for Android adds this functionality.
Use GoogleMap.setPadding()
to add padding to the "active" area (including the Google logo and copyright notices) while still filling the full container.
https://developers.google.com/maps/documentation/android/map#map_padding
You can move the google logo with the help of the Tag assigned to it GoogleWatermark
. In the below code i have moved it to top right corner of the screen.
View googleLogo = binding.missionMap.findViewWithTag("GoogleWatermark");
RelativeLayout.LayoutParams glLayoutParams = (RelativeLayout.LayoutParams)googleLogo.getLayoutParams();
glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0);
glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0);
glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_START, 0);
glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_END, RelativeLayout.TRUE);
googleLogo.setLayoutParams(glLayoutParams);
where missionMap
is the framelayout to which the MapFragment
has been added.
I had the same issue, but you can achieve what you want without conflicting with Google's Terms and Conditions. The main thing is to put your mapView in a Frame layout, such as this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<FrameLayout android:id="@+id/map_frame"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.7" >
<com.google.android.maps.MapView
android:id="@+id/map_view"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="mySecretMapsApiKey"/>
</FrameLayout>
<ws.mentis.android.guardian.ui.MapNavBar
android:id="@+id/map_nav"
android:layout_width="fill_parent"
android:layout_height="70dip"
android:layout_gravity="bottom"
android:layout_weight="0.3" />
</LinearLayout>
I had a number of buttons to included, so I created them in a custom widget (MapNavBar). As you can see from the screen shot, the Google logo is still visible and in its normal place, within the new window.
This is working in Android 2.2 It also has the benefit that the standard zoom control also moves up so it doesn't interfere with your own buttons.