Reputation: 412
I know that android automatically uses sliding animations if you open and close activities. Then they slide from left to right and fill the screen (or from right to left). The thing is that the animation is quite fast... it is visible on the emulator but it is barely noticeable on the phone itself. I am wondering if there is any way to slow down this animation so it would definitely be seen that the view is sliding.
Upvotes: 6
Views: 3753
Reputation: 470
you can specify the duration of the animation in your animation .xml
in res/anim
for example for sliding out left:
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" >
<translate
android:duration="500"
android:fromXDelta="0%"
android:fromYDelta="0%"
android:toXDelta="-100%"
android:toYDelta="0%" />
</set>
Upvotes: 1
Reputation: 6588
First prevent the default animation (Slide in from the right) with the Intent.FLAG_ACTIVITY_NO_ANIMATION
flag in your intent.
ie.,
Intent myIntent = new Intent(context, MyActivity.class);
myIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
context.startActivity(myIntent);
Now you can load your own custom animation. Refer this link to know how to animate your activity's in and out.
Upvotes: 3