Reputation: 11782
i Am trying to slide a whole view from RIght to left and left to right.
Here is the code
Utilities.vibrate(v.getContext());
Animation animation = AnimationUtils.loadAnimation(v.getContext(), R.anim.leave);
mainView.startAnimation(animation);
This will make it move from left to right. Here is leave.xml code
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate android:fromXDelta="-90%" android:toXDelta="0%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="700"/>
</set>
It works fine however once the transition is done. It moves back to its original position. How can I make it stay at the slider position?
Upvotes: 0
Views: 110
Reputation: 5440
Add these lines after declaring your animation,
animation.setFillAfter(true);
animation.setFillEnabled(true);
Upvotes: 1