我在使用 FragmentActivity 和 SupportMapFragment 时遇到了一些问题。地图的缩放很不稳定。这是代码:
public class GoogleMapActivity extends FragmentActivity{
Double longitude, latitude;
static LatLng koordinate;
GoogleMap supportMap;
String title, address;
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_googlemaps);
SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
supportMap = fm.getMap();
longitude = 13.597651720046997;
latitude = 45.22456639103469;
title = "Turistička zajednica Općine Vrsar";
address = "ul. Rade Končara 46";
koordinate = new LatLng(longitude, latitude);
Marker marker = supportMap.addMarker(new MarkerOptions().position(koordinate).title(title).snippet(address)
.icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_star)));
//supportMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
supportMap.moveCamera(CameraUpdateFactory.newLatLngZoom(koordinate, 15));
supportMap.animateCamera(CameraUpdateFactory.zoomTo(12), 2000, null);
}}
出于某种原因,我在谷歌地图中得到以下内容,但缩放不够:http: //imageshack.us/f/812/3yl.png/ 当我点击缩放时,地图进入这种状态: http: //imageshack.us/f/825/k8np.png/
我需要地图放大到足以显示街道名称。这在我以前的应用程序中工作得很好,但我在那里使用了常规的 MapFragment。对于这个应用程序,我需要 SupportMapFragment。也许这导致了这个问题?