3
我無法在Android應用程序上更改地圖類型,一切正常,但此功能不是。在GoogleMaps v2中使用Android上的複選框更改MapView的地圖視圖
這是MapActivity類
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
this.locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
mMapFragment = MapFragment.newInstance();
setContentView(R.layout.activity_map_fabio);
options.mapType(GoogleMap.MAP_TYPE_NORMAL)
.compassEnabled(true)
.scrollGesturesEnabled(true)
.zoomGesturesEnabled(true)
.tiltGesturesEnabled(true);
MapFragment.newInstance(options);
mMap = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
android.app.FragmentTransaction fragmentTransaction =
getFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.map, mMapFragment);
fragmentTransaction.commit();
satellite = (CheckBox) findViewById(R.id.satellite);
satellite.setOnCheckedChangeListener(new OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if (satellite.isChecked()){
mMap.getUiSettings().setAllGesturesEnabled(true);
options.mapType(GoogleMap.MAP_TYPE_SATELLITE);
}
}
});
的檢查,聽取的一部分,但地圖上不改變視圖。
檢查這一點,肯定會幫助你。 http://wptrafficanalyzer.in/blog/android-google-map-switching-between-map-view-and-satellite-view/ – TheFlash 2013-04-30 08:59:52
什麼都不起作用,以及如何? – 2013-04-30 09:39:45
當我點擊複選框時,視圖不會改變 – Fabio 2013-05-02 10:24:49