问题
I would like to put transparent (map visible under it) button over mapview? How can i achieve that?
回答1:
Try using this on the button android:background="@null" or android:background="@android:color/transparent" EDIT: to place over use a relative layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.maps.MapView android:id="@+id/google_maps"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="@string/maps_key"/>
<Button android:id="@+id/googlemaps_select_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="Select"/>
</RelativeLayout>
回答2:
You could wrap the map in a FrameLayout or something. Then add a button to the FrameLayout and use android:layout_alignParentRight="true"
for Right, Left, Top and Bottom. The button will then align it's edges with the edges of the FrameLayout, which should be wrapping the map.
来源:https://stackoverflow.com/questions/11626182/how-put-put-one-transparent-button-over-mapview