小编Mad*_*Boy的帖子

在模式卫星和地形中查看地图

我尝试在屏幕上创建一个菜单,该菜单将在卫星模式和地形中显示地图。

我的代码:

public boolean onOptionsItemSelected(MenuItem item) {
  switch (item.getItemId()) {
  case MENU_MyLocation:
   //startActivity(new Intent(this, MyLocation.class));
   return(true);
  case MENU_LocationCar:
   startActivity(new Intent(this, Gps.class));
   return(true);
  case MENU_Satellite:
      map.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
       return(true);
  case MENU_Terrain:
      map.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
   return(true);
  }

  return(super.onOptionsItemSelected(item));
}
Run Code Online (Sandbox Code Playgroud)

android google-maps google-maps-android-api-2

5
推荐指数
1
解决办法
4944
查看次数