0

SupportMapFragment 300dp를 가져와 화면 중앙에 배치해야합니다. 내 문제는 내가 이것을 할 때지도보기가 세계의 꼭대기 또는 맨 아래까지 펼쳐지지 않을 것입니다. 내가 한 모든 수색은 생산하고 대답하지 않았습니다. 아래에서는 스크린 샷과 XML 레이아웃을 사용했습니다.조각이 전체 화면보다 작 으면 Android SupportMap 부분이지도의 위쪽과 아래쪽으로 이동하지 않습니다.

모든 도움을 주시면 대단히 감사하겠습니다. 고맙습니다!


지도에서 볼 수 있듯이지도가 전체 화면이라고 생각하기 때문에 그린 랜드의 위쪽으로 잘립니다. 여기


<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/root_view" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 
    <fragment 
     android:layout_width="match_parent" 
     android:layout_height="300dp" 
     android:layout_centerInParent="true" 
     android:id="@+id/map" 
     android:name="com.google.android.gms.maps.SupportMapFragment"/> 

</RelativeLayout> 

enter image description here

내가 가기 예에서 패닝 맵이 전체 화면 인 경우 역할을 확인 할 수 있도록 실제로 전체 화면 인 예이다.

enter image description here

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/root_view" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 
    <fragment 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_centerInParent="true" 
     android:id="@+id/map" 
     android:name="com.google.android.gms.maps.SupportMapFragment"/> 

</RelativeLayout> 
+0

나는 당신이 당신이지도 스케일링에 대한 정보가 있나요 – bjiang

+0

@bjiang을 수행 할 맵을 확장하려고 할 수 있습니다 생각하십니까? – KevinM

답변

1

당신은 CameraUpdateFactory 클래스 here를 사용할 수 있습니다.

zoomBy(), zoomIn(), zoomOut(), zoomTo()은지도의 크기를 조절하는 데 사용할 수 있습니다.

지도를 초기화 할 수 있습니다.

샘플 코드 :

CameraUpdate center= 
     CameraUpdateFactory.newLatLng(new LatLng(40.76793169992044, 
               -73.98180484771729)); 
    CameraUpdate zoom=CameraUpdateFactory.zoomTo(15); 

    map.moveCamera(center); 
    map.animateCamera(zoom);