如何在google maps v2 android上添加类似标准地图按钮的按钮

如何在google maps v2 android上添加类似标准地图按钮的按钮,android,xamarin.android,google-maps-android-api-2,Android,Xamarin.android,Google Maps Android Api 2,我想在我的谷歌地图应用程序中添加一个类似于下面谷歌地图标准按钮的按钮。请看下图。第一个按钮是谷歌地图的标准按钮之一,第二个是用户自己添加的另一个自定义按钮 在下面的link@chintan khetiya中,描述了如何从布局代码向地图添加按钮,但这与标准按钮不同 这是@chintan khetiya的代码: 为了创建像下图中的按钮一样的按钮,最好的方法是什么?当然,位置必须正好低于标准按钮,而且图像应该保持其声音。 我们是否需要使用上面的布局代码并从布局中手动更改图像和位置,还是有更

我想在我的谷歌地图应用程序中添加一个类似于下面谷歌地图标准按钮的按钮。请看下图。第一个按钮是谷歌地图的标准按钮之一,第二个是用户自己添加的另一个自定义按钮

在下面的link@chintan khetiya中,描述了如何从布局代码向地图添加按钮,但这与标准按钮不同

这是@chintan khetiya的代码:


为了创建像下图中的按钮一样的按钮,最好的方法是什么?当然,位置必须正好低于标准按钮,而且图像应该保持其声音。 我们是否需要使用上面的布局代码并从布局中手动更改图像和位置,还是有更好的方法?我认为谷歌应该创造另一种方式来为mao添加这样的按钮。有这样的方法吗

最后,我更喜欢以编程方式添加此按钮,而不是将其添加到布局中

谢谢


我做了很多研究,也阅读了谷歌开发者文档。谷歌似乎没有为添加这些按钮引入标准方法。唯一的方法是使用自定义布局和代码添加它们

最后,我对问题中介绍的布局代码进行了一些更改,并将其用于代码中。感谢@,因为他在中给出了很好的回答


我们应该注意的要点是,按钮似乎是
40dp
11dp
margin
来自
右侧

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

<FrameLayout
    android:id="@+id/fram_map"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <Button
        android:id="@+id/btn_draw_State"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Free Draw" />
</FrameLayout>
<fragment
    android:id="@+id/map"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    class="com.google.android.gms.maps.SupportMapFragment" />

<FrameLayout
    android:id="@+id/fram_map"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

     <Button
                android:id="@+id/btn_draw_State"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:layout_gravity="right|top"
                android:layout_marginTop="55dp"
                android:layout_marginRight="11dp" />
</FrameLayout>