2016-03-05 47 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); 

希望這會有所幫助。