2013-03-05 67 views
0

香港专业教育学院得到了谷歌地图API V2的工作,但是当我选择的应用程序映射为全屏。 我如何让它变小?特别是一组宽度和高度与屏幕的位置(左上角)重新缩放谷歌地图的看法?

在此先感谢

回答

1

您可以使用布局和参数在XML布局文件来改变大小,位置等。例如,从

<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> 
:用于示出4个象限屏幕的地图的4个拷贝谷歌的示例代码