This is due to the fact that a new api map is created using SurfaceView, and because of this animation this is not possible.
As a temporary patch I found is: Use the transparent view above the MapFragment . Therefore, if you animate MapFragment, it will be animated with it, and at that time the map will be invisible.
As an example:
<RelativeLayout android:id="@+id/main_view_panel" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="0.5" class="com.google.android.gms.maps.SupportMapFragment" map:cameraTargetLat="40.72" map:cameraTargetLng="-74.00" map:cameraZoom="8"/> <ImageView android:id="@+id/map_overlay" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#00000000" /> </RelativeLayout>
Try it. It should work.
Note. You may need to change your visibility when viewing animations. If you want the map to appear after the animation, you need to hide the overlay view and when you want to start the animation, you need to display the overlay view. But you have to make sure that the hide / unhide process will only be completed after the animation is complete.
Steps for animation :
- Before starting the animation, display the overlay display
- after the animation is completed, means that after some delay hides the overlay view
This works for me.
source share