android地图实时标记
生活随笔
收集整理的這篇文章主要介紹了
android地图实时标记
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
============問題描述============
我在用百度地圖給上邊做標注的時候,用了一下主要代碼:
class?MyOverlayItem?extends?ItemizedOverlay<OverlayItem>{ private?ArrayList<OverlayItem>?mOverlayList?=?new?ArrayList<OverlayItem>();private?double?mLat1?=?34.0358298501404;?//?point1緯度private?double?mLon1?=?108.7622674067471;?//?point1經度private?double?mLat2?=?geoPointList.get(0).getLat();?private?double??mLon2?=?geoPointList.get(0).getLongi();?public?MyOverlayItem(Drawable?drawable){super(drawable);GeoPoint?geoPoint?=?new?GeoPoint((int)(mLat1?*?1E6),?(int)(mLon1?*?1E6));GeoPoint?GeoPointBaidu?=?CoordinateConvert.fromWgs84ToBaidu(geoPoint);?mOverlayList.add(new?OverlayItem(GeoPointBaidu,?"point",?"point"));populate();}
問題出現了,若使用mLat1,mLon1作為坐標時就能正確打點,但是換成mLat2,mLon2就點打不上去,mLat2,mLon2其實值跟mLat1,mLon1是相同的。這里mLat2,mLon2也不是空值。我是在mainactivity中的handler中調用mMapView.getOverlays().add(new?MyOverlayItem(drawable));來實現的。求解,糾結了一天了,先謝過了。
============解決方案1============
刷新下畫布。
轉載于:https://www.cnblogs.com/yiguobei99/p/4030450.html
總結
以上是生活随笔為你收集整理的android地图实时标记的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android开发中调用系统窗口的方法
- 下一篇: 对象的属性