Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/204.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/80.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
在android上重新缩放谷歌地图视图?_Android - Fatal编程技术网

在android上重新缩放谷歌地图视图?

在android上重新缩放谷歌地图视图?,android,Android,我已经让谷歌地图api v2工作,但当我选择应用程序时,地图是全屏的。 我该如何使它变小?特别是设置宽度、高度和屏幕位置(左上角) 提前感谢您可以使用XML布局文件中的布局和参数来更改大小、位置等。例如,从google在屏幕的4个象限中显示4份地图副本的示例代码: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/a

我已经让谷歌地图api v2工作,但当我选择应用程序时,地图是全屏的。 我该如何使它变小?特别是设置宽度、高度和屏幕位置(左上角)


提前感谢

您可以使用XML布局文件中的布局和参数来更改大小、位置等。例如,从google在屏幕的4个象限中显示4份地图副本的示例代码:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:map="http://schemas.android.com/apk/res-auto"
  android:id="@+id/map_container"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical">
  <LinearLayout
    android:id="@+id/map_container2"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="0.5"
    android:orientation="horizontal">
    <fragment
      android:id="@+id/map1"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_weight="0.5"
      class="com.google.android.gms.maps.SupportMapFragment"
      map:cameraTargetLat="40.72"
      map:cameraTargetLng="-74.00"
      map:cameraZoom="8"/>
    <fragment
      android:id="@+id/map2"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_weight="0.5"
      class="com.google.android.gms.maps.SupportMapFragment"
      map:cameraTargetLat="51.51"
      map:cameraTargetLng="-0.12"
      map:cameraZoom="8"/>
  </LinearLayout>
  <LinearLayout
    android:id="@+id/map_container2"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="0.5"
    android:orientation="horizontal">
    <fragment
      android:id="@+id/map3"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_weight="0.5"
      class="com.google.android.gms.maps.SupportMapFragment"
      map:cameraTargetLat="48.85"
      map:cameraTargetLng="2.35"
      map:cameraZoom="8"/>
    <fragment
      android:id="@+id/map4"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_weight="0.5"
      class="com.google.android.gms.maps.SupportMapFragment"
      map:cameraTargetLat="35.69"
      map:cameraTargetLng="139.69"
      map:cameraZoom="8"/>
  </LinearLayout>
</LinearLayout>