當前位置: 首頁>>代碼示例>>Java>>正文


Java MapView.setEnabled方法代碼示例

本文整理匯總了Java中com.google.android.maps.MapView.setEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java MapView.setEnabled方法的具體用法?Java MapView.setEnabled怎麽用?Java MapView.setEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.maps.MapView的用法示例。


在下文中一共展示了MapView.setEnabled方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import com.google.android.maps.MapView; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
    setContentView(R.layout.main);
    
    mImageManager = ImageManager.getInstance(this);
    
    FrameLayout frame = (FrameLayout) findViewById(R.id.frame);
    Button goButton = (Button) findViewById(R.id.go);
    goButton.setOnClickListener(this);
   
    // Add the map view to the frame
    mMapView = new MapView(this, "Panoramio_DummyAPIKey");
    frame.addView(mMapView, 
            new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

    // Create an overlay to show current location
    mMyLocationOverlay = new MyLocationOverlay(this, mMapView);
    mMyLocationOverlay.runOnFirstFix(new Runnable() { public void run() {
        mMapView.getController().animateTo(mMyLocationOverlay.getMyLocation());
    }});

    mMapView.getOverlays().add(mMyLocationOverlay);
    mMapView.getController().setZoom(15);
    mMapView.setClickable(true);
    mMapView.setEnabled(true);
    mMapView.setSatellite(true);
    
    addZoomControls(frame);
}
 
開發者ID:tgmarinho,項目名稱:apps-for-android,代碼行數:32,代碼來源:Panoramio.java

示例2: onCreate

import com.google.android.maps.MapView; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    FrameLayout frame = new FrameLayout(this);
    mMapView = new MapView(this, "MapViewCompassDemo_DummyAPIKey");
    frame.addView(mMapView, 
            new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    setContentView(frame);

    mMyLocationOverlay = new MyLocationOverlay(this, mMapView);

    mMarker = getResources().getDrawable(R.drawable.map_pin);
    
    // Make sure to give mMarker bounds so it will draw in the overlay
    final int intrinsicWidth = mMarker.getIntrinsicWidth();
    final int intrinsicHeight = mMarker.getIntrinsicHeight();
    mMarker.setBounds(0, 0, intrinsicWidth, intrinsicHeight);
    
    mMarkerXOffset = -(intrinsicWidth / 2);
    mMarkerYOffset = -intrinsicHeight;
    
    // Read the item we are displaying from the intent, along with the 
    // parameters used to set up the map
    Intent i = getIntent();
    mItem = i.getParcelableExtra(ImageManager.PANORAMIO_ITEM_EXTRA);
    int mapZoom = i.getIntExtra(ImageManager.ZOOM_EXTRA, Integer.MIN_VALUE);
    int mapLatitudeE6 = i.getIntExtra(ImageManager.LATITUDE_E6_EXTRA, Integer.MIN_VALUE);
    int mapLongitudeE6 = i.getIntExtra(ImageManager.LONGITUDE_E6_EXTRA, Integer.MIN_VALUE);
    
    final List<Overlay> overlays = mMapView.getOverlays();
    overlays.add(mMyLocationOverlay);
    overlays.add(new PanoramioOverlay());
    
    final MapController controller = mMapView.getController();
    if (mapZoom != Integer.MIN_VALUE && mapLatitudeE6 != Integer.MIN_VALUE
            && mapLongitudeE6 != Integer.MIN_VALUE) {
        controller.setZoom(mapZoom);
        controller.setCenter(new GeoPoint(mapLatitudeE6, mapLongitudeE6));
    } else {
        controller.setZoom(15);
        mMyLocationOverlay.runOnFirstFix(new Runnable() {
            public void run() {
                controller.animateTo(mMyLocationOverlay.getMyLocation());
            }
        });
    }

    mMapView.setClickable(true);
    mMapView.setEnabled(true);
    mMapView.setSatellite(true);
    addZoomControls(frame);
}
 
開發者ID:tgmarinho,項目名稱:apps-for-android,代碼行數:54,代碼來源:ViewMap.java


注:本文中的com.google.android.maps.MapView.setEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。