MyLocationOverlay 未出现
当我调用此方法时,蓝点不会出现在地图上,直到我从 ddms 发送位置, 然后它突然出现了。
private void findMyLocation(final Location location){
final MyLocationOverlay myLocationOverlay = new MyLocationOverlay(this, mapView);
myLocationOverlay.enableMyLocation();
myLocationOverlay.enableCompass();
final GeoPoint point = new GeoPoint((int) (location.getLatitude() * 1E6),
(int) (location.getLongitude() * 1E6));
controller.animateTo(point);
controller.setCenter(point);
mapView.getOverlays().add(myLocationOverlay);
mapView.postInvalidate();
}
调用此方法后如何立即显示该蓝点? 多谢。
when I call this method the blue dot is not appearing on the map, until i send location from ddms,
then suddenly it appears.
private void findMyLocation(final Location location){
final MyLocationOverlay myLocationOverlay = new MyLocationOverlay(this, mapView);
myLocationOverlay.enableMyLocation();
myLocationOverlay.enableCompass();
final GeoPoint point = new GeoPoint((int) (location.getLatitude() * 1E6),
(int) (location.getLongitude() * 1E6));
controller.animateTo(point);
controller.setCenter(point);
mapView.getOverlays().add(myLocationOverlay);
mapView.postInvalidate();
}
how can i show that blue dot right after calling this method?
thanks a lot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不能。
MyLocationOverlay
,顾名思义,显示用户的位置。如果设备/模拟器不知道用户的位置,则无法显示。就设备而言,在确定用户的位置(例如,GPS)之前,它不会显示用户的位置。
在模拟器的情况下,它不会显示用户的位置,直到它确定所述位置(例如,DDMS)。
You can't.
MyLocationOverlay
, as its name suggests, shows the user's location. If the device/emulator does not know the user's location, it cannot show it.In the case of the device, it will not show the user's location until it has determined said location (e.g., GPS).
In the case of the emulator, it will not show the user's location until it has determined said location (e.g., DDMS).