是否可以自定義位置標記? 我已經搜索了很多,並找到很多有關標記的手冊,但沒有任何關於默認位置標記。 我試圖做這樣的事情:在advace谷歌地圖api v2自定義位置標記
1
A
回答
0
我找到了解決方案。 Neseccery禁用內置位置監聽器,並通過標準位置管理器實現它。
禁用內置的位置管理:
mMap = mapView.getMap();
mMap.setMyLocationEnabled(false);
實施非標準Android的外景經理:
lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_COARSE);
String provider = lm.getBestProvider(criteria, true);
lm.requestLocationUpdates(provider, 0, 0, this);
內onLocationChanged梅託德畫在地圖上
@Override
public void onLocationChanged(Location location) {
// draw custom marker
MarkerOptions mp = new MarkerOptions();
mp.position(new LatLng(location.getLatitude(), location.getLongitude()));
mp.icon(myLocationBitmap);
mMap.addMarker(mp);
}
0
呀,它可能
THX。要做到這一點,首先要創建一個標記,標註經度和緯度。接下來,您可以通過執行以下操作更改默認標記:
marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.my_marker_icon)));
這將允許標記自定義。
享受!
是的,它可能是您的位置。 https://developers.google.com/maps/documentation/android/marker – 2014-09-23 16:41:17
請參閱http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/,這是很好的教程。 – 2014-09-23 16:43:56
這似乎是每個人都誤解了我。我討厭我的位置標記,那個小小的藍色圓圈 – 2014-09-24 05:56:28