I am trying to slide a view from right to left whose visibility is GONE
on click of a button and reverse on click of another button. I have tried the below solution. But it requires the view to be VISIBLE
and it will slide the view
from one position to another. I want to have a sliding effect as the navigation drawer
does but with a view
. How can I achieve that?
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fillAfter="true">
<translate
android:fromXDelta="0%p"
android:toXDelta="75%p"
android:duration="800" />
</set>
imageView = (ImageView) findViewById(R.id.img);
// Load the animation like this
animSlide = AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.slide);
// Start the animation like this
imageView.startAnimation(animSlide);