2013-04-24 72 views
2

刪除按鈕疊加我有一個非常簡單的SupportMapFragment顯示一個小的谷歌地圖,我在此視圖 enter image description here從SupportMapFragment

的想法是,用戶可以單擊它來查看全屏地圖使用。 我該如何擺脫地圖上的+/-按鈕? 如果這是不可能的,是否有另一種方法來獲得地圖?

這裏是我的MapFragment代碼:

public class CustomMapFragment extends SupportMapFragment { 
    private static LatLng mPosFija; 

    public CustomMapFragment() { 
     super(); 

    } 

    public static CustomMapFragment newInstance(LatLng position) { 
     CustomMapFragment fragment = new CustomMapFragment(); 
     mPosFija = position; 
     return fragment; 
    } 

    @Override 
    public void onActivityCreated(Bundle savedInstanceState) { 
     super.onActivityCreated(savedInstanceState); 

     if (getMap() != null) { 
      initMap(); 
      Log.d(getClass().getSimpleName(), "Map ready for use!"); 
     } 
    } 

    @Override 
    public void onResume() { 
     super.onResume(); 
     initMap(); 
    } 

    private void initMap() { 
     Log.v("CustomMapFragment", "initMap"); 
     if (getMap() != null) { 
      UiSettings settings = getMap().getUiSettings(); 
      settings.setAllGesturesEnabled(true); 
      settings.setMyLocationButtonEnabled(false); 

      getMap().clear(); 
      getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(mPosFija, 5)); 
      getMap().addMarker(new MarkerOptions().position(mPosFija).draggable(false)); 
     } 
    } 
} 

這是增加了mapFragment到視圖我DialogFragment代碼:

@Override 
    public void onActivityCreated(Bundle savedInstanceState) { 
     super.onActivityCreated(savedInstanceState); 

     if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity()) == ConnectionResult.SERVICE_INVALID 
       || GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity()) == ConnectionResult.SERVICE_MISSING) { 
      Log.e("HERE", "Google play not active"); 

      TextViewFragment tvf = new TextViewFragment(); 
      getChildFragmentManager().beginTransaction().replace(R.id.mapview, tvf).commit(); 

     } else { 

      CustomMapFragment mMapFragment = CustomMapFragment.newInstance(new LatLng(offer.latitude, offer.longitude)); 
      getChildFragmentManager().beginTransaction().replace(R.id.mapview, mMapFragment).commit(); 
     } 

    } 

回答

6

好了,這是盯着我的臉和就像

UiSettings settings = getMap().getUiSettings(); 
      settings.setAllGesturesEnabled(false); 
      settings.setMyLocationButtonEnabled(false); 
      settings.setZoomControlsEnabled(false);