2013-03-05 65 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個拷貝谷歌的示例代碼