I have a LinearLayout which is within a RelativeLayout and aligned to the bottom of it. It's height is wrap_content. What I'm trying to do is when the user presses a button and the action that the button does is completed, I want this LinearLayout to slide out of the bottom of the screen. So when the animation is done the LinearLayout will no longer be in the View.
When the animation happens what I'm actually seeing is the LinearLayout kind of flashes for a second and then nothing happens.
Here's my XML for the Layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:facebook="http://schemas.android.com/apk/res-auto"
android:id="@+id/splash_layout_id"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/splash_screen_barcastr"
android:gravity="center_horizontal"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/splash_loginBox"
android:layout_alignParentBottom="true"
android:orientation="vertical"
android:background="@drawable/message_editor_background_shadow"
android:layout_width="match_parent"
android:layout_height="wrap_content">
And this is my Animation:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="200"
android:fromYDelta="0%"
android:toYDelta="100%" />
<alpha
android:duration="200"
android:fromAlpha="1.0"
android:toAlpha="0.0" />
Here's where I call it:
Animation slideOutAnimation = AnimationUtils.loadAnimation(getActivity(), R.drawable.splash_login_slide_out);
slideOutAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
}
});
//Now Set your animation
loginContainer.startAnimation(slideOutAnimation);