- package com.mingrisoft;
- import android.os.Bundle;
- import com.google.android.maps.GeoPoint;
- import com.google.android.maps.MapActivity;
- import com.google.android.maps.MapController;
- import com.google.android.maps.MapView;
- public class PositionActivity extends MapActivity {
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- MapView mapView = (MapView) findViewById(R.id.mapview);
- MapController controller = mapView.getController();
- mapView.setEnabled(true);
- mapView.setClickable(true);
- mapView.setBuiltInZoomControls(true);// 设置地图支持缩放
- mapView.setTraffic(true);
- // 设置起点为北京
- GeoPoint point = new GeoPoint((int) (39.915833 * 1000000), (int) (116.390556 * 1000000));
- controller.animateTo(point);// 定位到北京
- controller.setZoom(15);// 设置倍数
- }
- protected boolean isRouteDisplayed() {
- return false;
- }
- }
复制代码 |
|