2016-03-05 41 views
0

我正在工作的Android动画滑下它的工作正常,但我需要应该工作正好相反,意味着它应该打开从下到上目前其自上而下的开放。如何向下滑动动画将工作相反

我的代码是:

<scale 
    android:duration="900" 
    android:fromXScale="1.0" 
    android:fromYScale="0.0" 
    android:interpolator="@android:anim/linear_interpolator" 
    android:toXScale="1.0" 
    android:toYScale="1.0" /> 
+1

http://stackoverflow.com/questions/35691188/android-text-view-transition/35691469#35691469 – saeed

+0

非常感谢你@saeed –

回答

1

假设你是从一个活动导航到活动二。 就在这个代码添加到您的动画文件动画文件夹

slide_up_from_bottom.xml

<set xmlns:android="http://schemas.android.com/apk/res/android"> 
<translate 
    android:duration="300" 
    android:fromYDelta="100%p" 
    android:toYDelta="0" /> 

然后,你需要做一个空白动画

no_animation.xml

<set xmlns:android="http://schemas.android.com/apk/res/android"> 
<translate 
    android:duration="300" 
    android:fromYDelta="0%p" 
    android:toYDelta="0%p" /> 
</set> 

然后将下面的行添加到您的A活动两个onCreate方法之前setContentView(layoutId)

 overridePendingTransition(R.anim.slide_up_from_bottom, R.anim.no_animation); 

希望这会有所帮助。