Moving MapFragment (SurfaceView) causes black background flickering

后端 未结 16 1420
误落风尘
误落风尘 2020-12-04 09:32

I\'m trying to implement new Android Google Maps API (v2). However it doesn\'t seem to go well with SlidingMenu. As you may know, MapFragment implementation is

16条回答
  •  半阙折子戏
    2020-12-04 09:50

    I had the same problem and used a workaround based on changing the "Visibility".

    private GoogleMap mMap;
    private SupportMapFragment mMapFragment;
    
    mMapFragment = ((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.mapFragment));
    mMap = mMapFragment.getMap();
    
    //Change the visibility to 'INVISIBLE' before the animation to go to another fragment.
    mMapFragment.getView().setVisibility(View.INVISIBLE);
    
    //Change the visibility to 'VISIBLE' after coming back to the original fragment that has map fragment.
    mMapFragment.getView().setVisibility(View.VISIBLE);
    

提交回复
热议问题