我在地图上添加了几个标记,我希望他们在放大或缩小时调整图标大小。怎么做?
这是我的代码:
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
if (map!=null) {
map.getUiSettings().setCompassEnabled(true);
map.setTrafficEnabled(true);
map.setMyLocationEnabled(true);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(defaultLatLng, zoomLevel));
this.addMarkers(new MarkerOptions());
这是我的addMarkers方法:
public void addMarkers(MarkerOptions mo) {
db = new Database(this);
SQLiteDatabase dbRead = db.getReadableDatabase();
String[] columns = {"title", "addr", "lat", "lon"};
Cursor result = dbRead.query("people", columns, null, null, null, null, null);
while(result.moveToNext()){
String person = result.getString(0);
String address = result.getString(1);
float lat = result.getFloat(2);
float lon = result.getFloat(3);
map.addMarker(mo.position(new LatLng(lat, lon))
.title(person)
.snippet(address)
.icon(BitmapDescriptorFactory.fromResource(R.drawable.marker)));;
}
}