3

I am struggling with using custom animation for the orientation change on Android. Basically what i want to do is, that whenever user rotates the phones, the new screen in landscape mode will slide in from the right to left. I found a similar topic (http://stackoverflow.com/questions/6043730/android-animation-on-orientation-change) unfortunately it does not asnwer my question. The animation is defined as follows :

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" 
   android:interpolator="@android:anim/accelerate_interpolator">
   <translate android:fromXDelta="100%p"
      android:toXDelta="0"
      android:duration="550" />
</set>

For applying the animation I used:

overridePendingTransition(R.anim.slide_right, 0);

Either directly after:

startActivity(...);

or

super.onCreate();

Unfortunately none of them worked. The animation works fine whenever I make transition between activities while staying in portrait mode, but whenever I try to use when I move from portrait to landscape - it does not work. I will really appreciate your help !

tomak
  • 167
  • 2
  • 7

0 Answers0