Android: MapFragment not moving in an animation

android, android-animation, mapfragment

Solution

This works on newer versions of android

mainViewPanel.animate().translationX(500);

Problem

I have a view that has a MapFragment in it My mainViewPanel looks something like this ``` <LinearLayout android:id="@+id/main_view_panel" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="0.5" 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"/> </LinearLayout> ``` My translate code looks like this ``` TranslateAnimation anim = new TranslateAnimation(0, 500, 0, 0); anim.setFillAfter(true); anim.setDuration(250); mainViewPanel.startAnimation(anim); ``` The rest of the view animates, but the map stays put. It's like the main view window is moving over and I can see more to the right of the map, but the map itself is not visually moving. The animation works just fine for other views like a TextView

Original source