2016-08-30 3 views
0

Google지도 활동을 직접 구현했지만 아무 소용이 없었습니다. 나는 마커가 나타나지 않는 문제에 부딪쳤다. 몇 시간 후에 그것을 알아 채지 못했고, 나는 나의 코드를 삭제하고이 사람들의 작업 예제를 복사했다. 나는 그것을 실행할 때를 제외하고는 똑같은 문제입니다. 지도가 지정된 위치로 확대되거나지도 아이콘이 표시되지 않습니다. 그게 onReady 섹션에 문제가 있다고 믿게하지만 확실하지 않습니다. 다른 스택 질문/답변을 따르려고했는데 무엇이 잘못되었는지를 알 수 없습니다. 그것은 수동으로 주변을 확대 할 수있는 구글 맵스를 보여 주며 거리와 기타 등등을 업데이트하지만 마커는 없다.Google지도에 마커가 표시되지 않았습니다. android

Pastebin Link to Java Code

XML 파일 : onMapReady에 markeroptions 코드() 메소드를 추가하여
<fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/map" android:name="com.google.android.gms.maps.SupportMapFragment" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.test.logintest.MapsActivity" />

답변

0

보십시오. 현재 위치 변경 (onLocationChanged())이있을 때 마커를 추가하는 것처럼 작동 할 수도 있습니다.

LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); 
    MarkerOptions markerOptions = new MarkerOptions(); 
    markerOptions.position(latLng); 
    markerOptions.title("Current Position"); 
    markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA)); 
    mCurrLocationMarker = mGoogleMap.addMarker(markerOptions); 
+0

그래서 코드를 복사하여 권한 검사 후 onReady 메서드에 정확하게 배치했습니다. 테스트 목적으로 새 LatLng을 (100,100)으로 설정했지만 마커는 여전히 인앱에 표시되지 않습니다. – Gabe

0

발견. 그것은 실제로 다른 Java 파일의 실수였습니다. 실습을 전환하려고했지만 실제로 활동을 전환하는 대신보기 만 변경했습니다.

관련 문제