谁能告诉我如何使用自定义图标在 OSM 地图上显示我当前的位置?
使用默认人物图标:
MyLocationNewOverlay myLocationoverlay = new MyLocationNewOverlay(mapView);
myLocationoverlay.enableFollowLocation();
myLocationoverlay.enableMyLocation();
mapView.getOverlays().add(myLocationoverlay);
使用自定义图标:
MyLocationNewOverlay myLocationoverlay = new MyLocationNewOverlay(mapView);
myLocationoverlay.enableFollowLocation();
Drawable currentDraw = ResourcesCompat.getDrawable(getResources(), R.mipmap.ic_launcher, null);
Bitmap currentIcon = null;
if (currentDraw != null) {
currentIcon = ((BitmapDrawable) currentDraw).getBitmap();
}
myLocationoverlay.setPersonIcon(currentIcon);
myLocationoverlay.enableMyLocation();
mapView.getOverlays().add(myLocationoverlay);
我正在使用更新的 OSM 依赖项
compile 'org.osmdroid:osmdroid-android:5.6.5'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)