How put put one transparent button over mapview?

跟風遠走 提交于 2019-12-08 09:31:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!