Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在MapView android上添加按钮_Android_Button_Android Mapview - Fatal编程技术网

如何在MapView android上添加按钮

如何在MapView android上添加按钮,android,button,android-mapview,Android,Button,Android Mapview,正如你从问题中看到的,我需要在mapView上放置一些按钮,应用程序将通过按用户按下按钮来刷新mapView的当前位置。 我知道怎么把按钮放在上面,下面,但怎么把它放在地图上??? 如果有人有一些示例代码,或一些指导帮助,我们将不胜感激 您需要使用RelativeLayout并将按钮放置在地图视图的顶部。只是要确保不要把它放在谷歌的标志上。下面是一个示例XML: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout x

正如你从问题中看到的,我需要在mapView上放置一些按钮,应用程序将通过按用户按下按钮来刷新mapView的当前位置。 我知道怎么把按钮放在上面,下面,但怎么把它放在地图上???
如果有人有一些示例代码,或一些指导帮助,我们将不胜感激

您需要使用RelativeLayout并将按钮放置在地图视图的顶部。只是要确保不要把它放在谷歌的标志上。下面是一个示例XML:

<?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>

Hi-man搜索覆盖项是您需要的:D here google链接

好的样品:D


谢谢你,伙计……这就是我一直在寻找的……再次感谢你:谢谢!这对我很有帮助!我没有时间看那个代码,但我会的…谢谢你的麻烦;))