Requirement
I can translate layout base on toYDelta="100%
or toYDelta="50%
etc.
But I want to animate layout only in 300dp Height
.
slide_down.xml
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="500"
android:fromYDelta="0"
android:toYDelta="100%" />
slide_up.xml
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="500"
android:fromYDelta="100%"
android:toYDelta="0" />
Java Code (Animation)
Animation animation = AnimationUtils.loadAnimation(getActivity().getApplicationContext(),R.anim.slide_down);
animation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationEnd(Animation animation) {
// TODO Auto-generated method stub
// I can hide layout after animation completion
}
});
Mockup
Problem
How to do base on 300dp height?
Please help me for this problem.
Thank you.