So basically I have this when you click on the image the image will move to the right but when the animation is done it will go back to the original position? How can I make it so it will stop at the spot it ends at in the animation? Here’s my code
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="0%" android:toXDelta="70%" android:duration="1000"/>
</set>
This is my slide_in_right.xml
public void sideBar()
{
ImageView sidebar = (ImageView)findViewById(R.id.sidebar);
mSlideInRight = AnimationUtils.loadAnimation(this, R.anim.slide_in_right);
sidebar.startAnimation(mSlideInRight);
}
And this is the code where it slides to the right
Use the
AnimationsetFillAfter(true)method to persist the animation.Then
In your case, code should be