本文整理汇总了Java中org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay.enableMyLocation方法的典型用法代码示例。如果您正苦于以下问题:Java MyLocationNewOverlay.enableMyLocation方法的具体用法?Java MyLocationNewOverlay.enableMyLocation怎么用?Java MyLocationNewOverlay.enableMyLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay
的用法示例。
在下文中一共展示了MyLocationNewOverlay.enableMyLocation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addLocationOverlay
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入方法依赖的package包/类
public static MyLocationNewOverlay addLocationOverlay(Context context, MapView map)
{
MyLocationNewOverlay locationOverlay = new MyLocationNewOverlay(context,
new GpsMyLocationProvider(context), map);
if (!locationOverlay.enableMyLocation())
return null;
Bitmap icon = BitmapFactory.decodeResource(context.getResources(), R.drawable.user_location);
locationOverlay.setPersonIcon(icon);
locationOverlay.setPersonHotspot(icon.getWidth() / 2, icon.getHeight());
map.getOverlays().add(locationOverlay);
return locationOverlay;
}
示例2: enableMyLocationOverlay
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入方法依赖的package包/类
/**
* Initialize the map layer and feature to show user's location
* on the map.
*/
private void enableMyLocationOverlay(){
if(userLocation == null){
myLocationOverlay = new MyLocationNewOverlay(new GpsMyLocationProvider(context),mapView);
}
myLocationOverlay.enableMyLocation();
myLocationOverlay.disableFollowLocation();
myLocationOverlay.setOptionsMenuEnabled(true);
if(!mapView.containsOverlay(OverlayTags.MY_LOCATION))
mapView.addOverlay(myLocationOverlay, OverlayTags.MY_LOCATION);
}
示例3: onCreate
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Initialize location requests
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
bestProvider = getLocationManager().getBestProvider(criteria, true);
// Create map
setContentView(R.layout.activity_map);
backButtonCount = 0;
mMap = (MapView) this.findViewById(R.id.map);
mMap.setTileSource(getTileSource());
mMap.setBuiltInZoomControls(true);
mMap.setMultiTouchControls(true);
mMap.getController().setZoom(3);
initLocation();
// Add your own location
mMyLocationOverlay = new MyLocationNewOverlay(getApplicationContext(), mMap);
mMyLocationOverlay.enableMyLocation();
mMyLocationOverlay.setDrawAccuracyEnabled(true);
mMap.getOverlays().add(mMyLocationOverlay);
resourceProxy = new DefaultResourceProxyImpl(getApplicationContext());
}
示例4: addOverlays
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入方法依赖的package包/类
@Override
public void addOverlays() {
overlay = new MyLocationNewOverlay(mMapView);
overlay.setEnableAutoStop(false);
overlay.enableFollowLocation();
overlay.enableMyLocation();
mMapView.setBuiltInZoomControls(true);
this.mMapView.getOverlayManager().add(overlay);
}
示例5: addOverlays
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入方法依赖的package包/类
public void addOverlays() {
mLocationOverlay = new MyLocationNewOverlay(mMapView);
mLocationOverlay.setEnableAutoStop(false);
mLocationOverlay.enableFollowLocation();
mLocationOverlay.enableMyLocation();
this.mMapView.getOverlayManager().add(mLocationOverlay);
mMapView.setBuiltInZoomControls(true);
mMapView.setMultiTouchControls(true);
mMapView.setTilesScaledToDpi(true);
}