Android片段幻灯片动画无效

时间:2014-06-03 13:00:53

标签: android android-fragments android-animation

我有两个片段顶部和底部。在向下滑动手势时,底部片段被隐藏,在向上滑动时,它会再次显示。向上滑动向上滑动动画正在工作,但在向下滑动时不会向下滑动动画。

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/baseLinear"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:weightSum="1" >

    <RelativeLayout
        android:id="@+id/containerParent"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/container1Parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" >

        <FrameLayout
            android:id="@+id/container"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/container1Parent"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true" >

        <FrameLayout
            android:id="@+id/container1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </RelativeLayout>

  case SimpleGestureFilter.SWIPE_UP:
    str = "Swipe Up";
 getSupportFragmentManager()
 .beginTransaction()
 .setCustomAnimations(R.anim.abc_slide_in_bottom,
 R.anim.abc_slide_out_bottom).show(bottomFragment)
    .commit();
   break;

abc_slide_in_bottom.xml

<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="50%p"
android:interpolator="@android:anim/decelerate_interpolator"
android:toYDelta="0" />

abc_slide_out_bottom.xml

<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="0"
android:interpolator="@android:anim/accelerate_interpolator"
android:toYDelta="50%p" />

注意:底部只占总屏幕的20%

0 个答案:

没有答案