android谷歌地图设置国家属性

时间:2013-06-11 20:06:38

标签: android google-maps google-maps-android-api-2

我正在使用这个xml

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:map="http://schemas.android.com/apk/res-auto"
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    class="com.google.android.gms.maps.SupportMapFragment"
    map:cameraBearing="112.5"
    map:cameraTargetLat="34.8545"
    map:cameraTargetLng="37.0261"
    map:cameraTilt="30"
    map:cameraZoom="13"
    map:mapType="normal"
    map:uiCompass="false"
    map:uiRotateGestures="true"
    map:uiScrollGestures="false"
    map:uiTiltGestures="true"
    map:uiZoomControls="false"
    map:uiZoomGestures="true" />

让google地图缩放到一个国家,但我得到的是一个中间有蓝色线的屏幕,请问我做错了什么?

2 个答案:

答案 0 :(得分:1)

尝试删除map:cameraTilt="30"map:cameraBearing="112.5",看看会发生什么。

答案 1 :(得分:0)

我已经在我的xml文件中测试了你的xml代码并成功在我的设备上运行,但坐标不同......

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"
map:cameraBearing="112.5"
map:cameraTargetLat="18.5182355"
map:cameraTargetLng="73.8792761"
map:cameraTilt="30"
map:cameraZoom="13"
map:mapType="normal"
map:uiCompass="false"
map:uiRotateGestures="true"
map:uiScrollGestures="false"
map:uiTiltGestures="true"
map:uiZoomControls="false"
map:uiZoomGestures="true" />

您看到的蓝线可能是由于错误的lat-lon坐标...