2010-01-31 2 views
3

약 1 년 반 동안이 겉으로보기에는 간단한 문제가 해결되었습니다. MapView가 정상적으로 작동하며 기본 줌 키를 표시하고 항상 기본 위치에두고 싶습니다. 그들은 전혀 출현하지 않습니다 - 그들이 떠나는 것처럼 보이지는 않습니다.MapView에 표시 할 줌 버튼을 얻을 수 없습니다.

코드 :

public void onCreate(Bundle savedInstanceState) 
{ 
    super.onCreate(savedInstanceState); 

    setContentView(R.layout.main); 

    _altDisplay = (TextView) findViewById(R.id.altitudeDisplay); 
    _speedDisplay = (TextView) findViewById(R.id.speedDisplay); 
    _accuracyDisplay = (TextView) findViewById(R.id.accuracyDisplay); 

    _mapView = (MapView) findViewById(R.id.mapView); 
    _mapView.setBuiltInZoomControls(true); 

    _mapController = _mapView.getController(); 
    _mapController.setZoom(22); 

    _locationUpdates = new LocationUpdateHandler((LocationManager) getSystemService(Context.LOCATION_SERVICE)); 
    _locationUpdates.addObserver(this); 
} 

public void updateLocation(GeoPoint point, double altitude, float speed, float accuracy) 
{ 
    _mapController.setCenter(point); 

    _altDisplay.setText("Altitude: " + Double.toString(altitude)); 
    _speedDisplay.setText("Speed: " + Float.toString(speed)); 
    _accuracyDisplay.setText("Accuracy: " + Float.toString(accuracy)); 
} 

나는 setZoom을 주석 시도하고 updateLocation 방법에 setBuiltInZoom 컨트롤을 이동했습니다. 이 문제와 관련하여 많은 게시물을 찾았지만 해결할 수있는 것은 없습니다.

도움 주셔서 감사합니다.

+0

그 코드는 나에게 맞는 것 같습니다. XML에있는 코드일까요? 게시를 시도하면 우리가 볼 수 있습니다. –

답변

3

확대/축소 컨트롤은 사용자가 화면의 적절한 영역을 탭한 경우에만 나타납니다. 나는 그들이 화면에 영구히 머물게하는 것, 그들이 나타나게하는 방법을 알고 있지 않습니다.

0

commonsware에서 말한 것처럼 컨트롤을 강제로 표시 할 수는 없습니다.

그러나 MapController의 setZoom 메소드를 사용하여 자신 만의 컨트롤을 그리고지도의 축척을 설정할 수 있습니다.

관련 문제