当前位置: 首页>>代码示例>>Java>>正文


Java MapView.getOverlays方法代码示例

本文整理汇总了Java中com.google.android.maps.MapView.getOverlays方法的典型用法代码示例。如果您正苦于以下问题:Java MapView.getOverlays方法的具体用法?Java MapView.getOverlays怎么用?Java MapView.getOverlays使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.maps.MapView的用法示例。


在下文中一共展示了MapView.getOverlays方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import com.google.android.maps.MapView; //导入方法依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_map);
    init();
    
    mapView = (MapView) findViewById(R.id.mapview);
	mapView.setBuiltInZoomControls(true);
	mapController = mapView.getController();
	mapController.setZoom(13);
	
	startPoints = mapView.getOverlays();
	itemizedOverlay = new MapOverlay(getResources().getDrawable(R.drawable.marker));
	
	rebuildList();
}
 
开发者ID:marchold,项目名称:taxi-driver-droid,代码行数:18,代码来源:TaxiDriverMapActivity.java

示例2: onCreate

import com.google.android.maps.MapView; //导入方法依赖的package包/类
public void onCreate(Bundle bundle) {
		super.onCreate(bundle);
		setContentView(R.layout.main); // bind the layout to the activity

		// create a map view
		RelativeLayout linearLayout = (RelativeLayout) findViewById(R.id.mainlayout);
		mapView = (MapView) findViewById(R.id.mapview);

//		ZoomControls mZoom = (ZoomControls) mapView.getZoomControls();
//		linearLayout.addView(mZoom);
		mapController = mapView.getController();
		// Zoon 1 is world view
		mapController.setZoom(14);
		locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
		locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
				0, new GeoUpdateHandler());

		overlays = mapView.getOverlays();
		Drawable drawable = this.getResources()
				.getDrawable(R.drawable.push_pin);
		itemizedoverlay = new MyOverlays(drawable);
		
	}
 
开发者ID:vogellacompany,项目名称:codeexamples-android,代码行数:24,代码来源:CurrentLocation.java

示例3: onCreate

import com.google.android.maps.MapView; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
   public void onCreate(Bundle savedInstanceState)
   {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);
       
       mapView = (MapView) findViewById(R.id.mapView);
       mapView.setStreetView(true);
       mapView.setSatellite(true);
       LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);  
       View zoomView = mapView.getZoomControls();

       zoomLayout.addView(zoomView, 
           new LinearLayout.LayoutParams(
               LayoutParams.WRAP_CONTENT, 
               LayoutParams.WRAP_CONTENT)); 
       mapView.displayZoomControls(true);
       
       mc = mapView.getController();
       String coordinates[] = {"43.067874", "-89.40936"};
       double lat = Double.parseDouble(coordinates[0]);
       double lng = Double.parseDouble(coordinates[1]);
       
       p = new GeoPoint(
               (int) (lat * 1E6), 
               (int) (lng * 1E6));
    
       mc.animateTo(p);
       mc.setZoom(17); 
       
       //---Add a location marker---
       MapOverlay mapOverlay = new MapOverlay();
       List<Overlay> listOfOverlays = mapView.getOverlays();
       listOfOverlays.clear();
       listOfOverlays.add(mapOverlay); 
       
       mapView.invalidate();
   }
 
开发者ID:busradar,项目名称:busradar,代码行数:40,代码来源:MapsActivity.java

示例4: onCreate

import com.google.android.maps.MapView; //导入方法依赖的package包/类
/** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.main);
     MapView mapView = (MapView) findViewById(R.id.mapview);
     mapView.setBuiltInZoomControls(true);
     List<Overlay> mapOverlays = mapView.getOverlays();
     Drawable drawable = this.getResources().getDrawable(R.drawable.test);
     TestOverlay itemizedoverlay = new TestOverlay(drawable, this);
     DataBaseHelper myDbHelper = new DataBaseHelper(this.getApplicationContext());
     myDbHelper = new DataBaseHelper(this);

     try {

     	myDbHelper.createDataBase();

} catch (IOException ioe) {

	throw new Error("Unable to create database");

}

try {

	myDbHelper.openDataBase();

}catch(SQLException sqle){

	throw sqle;

}
     Stop[] s = Stop.getAllStops();
	for (int x = 0; x < s.length; x++)
		itemizedoverlay.addOverlay(new BusStop(s[x]));
     mapOverlays.add(itemizedoverlay);
 }
 
开发者ID:busradar,项目名称:busradar,代码行数:38,代码来源:Maptest.java

示例5: onCreateView

import com.google.android.maps.MapView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_map,
			null);

	mMapView = (MapView) root.findViewById(R.id.mapview);
	mMapView.setBuiltInZoomControls(true);
	mMapView.setSatellite(mSatellite);
	mOverlays = mMapView.getOverlays();
	mOverlays.add(new MetropolisOverlay());

	mLevel0 = (Button) root.findViewById(R.id.level0);
	mLevel1 = (Button) root.findViewById(R.id.level1);
	mLevel0.setSelected(mLevel == 0);
	mLevel1.setSelected(mLevel == 1);
	mLevel0.setOnClickListener(mLevelClickListener);
	mLevel1.setOnClickListener(mLevelClickListener);

	Button satelliteBtn = (Button) root.findViewById(R.id.satellite);
	satelliteBtn.setSelected(mSatellite);
	satelliteBtn.setOnClickListener(mSatteliteClickListener);

	mMapController = mMapView.getController();
	mMapController.setCenter(METROPOLIS_GEOPOINT);
	mMapController.setZoom(19);

	return root;
}
 
开发者ID:devoxx,项目名称:mobile-client,代码行数:30,代码来源:MapFragment.java

示例6: 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

示例7: onCreate

import com.google.android.maps.MapView; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
   public void onCreate(Bundle savedInstanceState)
   {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);

       mapView = (MapView) findViewById(R.id.mapView);
       mapView.setStreetView(false);
       mapView.setSatellite(false);

       // ZOOM CONTROL 
       LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);  
       View zoomView = mapView.getZoomControls();

       zoomLayout.addView(zoomView, 
           new LinearLayout.LayoutParams(
               LayoutParams.WRAP_CONTENT, 
               LayoutParams.WRAP_CONTENT)); 
       mapView.displayZoomControls(true);
       
       // SAT VIEW
       Button s = (Button) findViewById(R.id.sat);
       s.setOnClickListener(new View.OnClickListener() {
		
		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			toggleSatellite();
		}
	});
       
       mc = mapView.getController();
       
       //INIT DB
       DataBaseHelper myDbHelper = new DataBaseHelper(this.getApplicationContext());
       myDbHelper = new DataBaseHelper(this);

       try {
       	myDbHelper.createDataBase();
       } catch (IOException ioe) {
 			throw new Error("Unable to create database");
 		}

       try {
 			myDbHelper.openDataBase();
 		}catch(SQLException sqle){
 			throw sqle;
 		}

 		//PULL BUS STOPS FROM DB
 		stops = Stop.getAllStops();
 		StopOverlay itemizedOverlay = new StopOverlay(stops, this);
 		
 		listOfOverlays = mapView.getOverlays();
       listOfOverlays.clear();

       listOfOverlays.add(itemizedOverlay);
       
       // MyLocationOverlay
       MyLocationOverlay myLocationOverlay = new MyLocationOverlay(this, mapView);
       listOfOverlays.add(myLocationOverlay);
       myLocationOverlay.enableMyLocation();
       
       // GPS
       lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
   	
  	// Set the criteria for selection a location provider
  	criteria = new Criteria();
  	criteria.setAccuracy(Criteria.ACCURACY_FINE);
  	criteria.setAltitudeRequired(false);
  	criteria.setBearingRequired(false);
  	criteria.setCostAllowed(true);
  	criteria.setPowerRequirement(Criteria.POWER_LOW);
  
   }
 
开发者ID:busradar,项目名称:busradar,代码行数:77,代码来源:BusRadar.java


注:本文中的com.google.android.maps.MapView.getOverlays方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。