2014-02-11 4 views
0

Eclipse를 사용 중이며 일부 메소드가 GoogleMaps 객체에 표시되지 않습니다.GoogleMap 유형에 대해 getMap.setpadding()이 정의되지 않았습니다.

google-play-services_lib을 가져 왔으며 Google Play 서비스의 최신 버전이 있고 최신 API (버전 4.4.2 (API 19))를 실행하고 있는지 확인했으며 모두 제거했습니다. Map Fragment는 내 테스트 장치에서 잘 작동하지만 .setPadding()과 같은 메소드를 구현하려고하면 .setpadding이 GoogleMap 객체에 대해 정의되지 않은 오류가 발생합니다.

여기 : https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/GoogleMap#setPadding(int, int, int, int)

아이디어가 있으십니까?

공용 클래스 MapDemo는 활동 LocationListener를 구현 확장 {

GoogleMap googleMap; 
GoogleMapOptions options = new GoogleMapOptions(); 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.mapdemo); 


    try { 
     initilizeMap(); 
    } catch (Exception e) { 
     Log.e("ERROR", "ERROR IN CODE: " + e.toString()); 
     e.printStackTrace(); 
    } 

} 

private void initilizeMap() { 
    // Do a null check to confirm that we have not already instantiated the 
    // map. 
    if (googleMap == null) { 
     googleMap = ((MapFragment) getFragmentManager().findFragmentById(
       R.id.map)).getMap(); 


     googleMap.setMyLocationEnabled(true); 
     googleMap.setPadding(0,0,30,0); // **<--This method does not appear to be in the API!** 


     // Check if we were successful in obtaining the map. 
     if (googleMap != null) { 
      // The Map is verified. It is now safe to manipulate the map. 

       options.mapType(GoogleMap.MAP_TYPE_HYBRID) 
       .compassEnabled(false) .rotateGesturesEnabled(false) 
       .tiltGesturesEnabled(false) ; 




     } else { 
      Toast.makeText(getApplicationContext(), 
        "Sorry! unable to create maps", Toast.LENGTH_SHORT) 
        .show(); 
     } 
    } 
} 

답변

0

당신은 구글 플레이 서비스 라이브러리 프로젝트의 최신 버전을 사용하고 있습니까? Maps API 변경 내역에 따르면 setPadding() 메서드가 September 2013에 추가되었습니다.

0

그래서 문제가 발견되었습니다. 내가 가져온 google-play-services_lib는 Android SDK 관리자가 유지 관리하고 업데이트 한 google-play-services_lib 대신 수동으로 다운로드 한 사본에서 가져 왔습니다. 자, 마술처럼 새로운 방법이 있습니다!

관련 문제