Button 谷歌地图Android API v2上的透明按钮

Button 谷歌地图Android API v2上的透明按钮,button,transparent,google-maps-android-api-2,Button,Transparent,Google Maps Android Api 2,这件事我已经琢磨了一段时间了,但我似乎不明白。也许这里有人处理过类似的事情 我正试图在我的谷歌地图上放置一个按钮,使其透明 以下是我写的,但运气不好: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_h

这件事我已经琢磨了一段时间了,但我似乎不明白。也许这里有人处理过类似的事情

我正试图在我的谷歌地图上放置一个按钮,使其透明

以下是我写的,但运气不好:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:keepScreenOn="true" >

<fragment
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:name="com.google.android.gms.maps.SupportMapFragment"/>

<LinearLayout
    android:layout_width="40dp"
    android:layout_height="match_parent"
    android:layout_gravity="right"
    android:orientation="horizontal" >

    <Button
        android:id="@+id/button1"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:alpha=".30"
        android:text="@string/button1_label"
        android:background="@android:drawable/btn_default" />

</LinearLayout>


另外,如果您看到我的代码有任何错误,请随时指出。

android:alpha是在API 11中添加的。使用您自己的透明背景图像(或statelist中的一组图像)


如果这没有帮助,发布屏幕截图。这可以使回答更容易。

是的,我认为这就是它不起作用的原因。不过,使用透明图像是可行的,所以我会打电话给一个状态列表,看看这是否行得通。再次谢谢你,梅西!