如何给从上到下动画的android [英] how to give top to bottom animation android
问题描述
我能够给下到上的动画,当我去到下一个活动,但现在,当我pressed回到我使用同样的$ C $下从上到下动画给人的动画,但它总是去底部顶部,这样我的问题是如何给从上到下动画时,我pressed后退按钮在Android设备.. 我的code给动画低于
使用时,走从一个活动到使用意向等。
overridePendingTransition(R.anim.slide_in_up,R.anim.slide_out_up);
和XML是:slide_in_up.xml
< XML版本=1.0编码=UTF-8&GT?;
<翻译的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:fromYDelta =100%p的机器人:toYDelta =0%P
机器人:时间=@安卓整数/ config_longAnimTime/>
和slide_out_up.xml是
< XML版本=1.0编码=UTF-8&GT?;
<翻译的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:fromYDelta =0%P机器人:toYDelta = - 100%P
机器人:时间=@安卓整数/ config_longAnimTime/>
只是改变-100到100(除去负)在slide_out_up.xml
@覆盖
公共无效onBack pressed(){
完();
overridePendingTransition(R.anim.enter_anim,R.anim.exit_anim);
}
i am able to give bottom to top animation when i go to next activity but now when i pressed back i am using same code for giving animation from top to bottom animation but it always goes to bottom to top so my question is how to give animation from top to bottom when i pressed back button on android device.. my code for giving animation is below
use when go from one activity to other using intent..
overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up );
and xml is: slide_in_up.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromYDelta="100%p" android:toYDelta="0%p"
android:duration="@android:integer/config_longAnimTime"/>
and slide_out_up.xml is
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromYDelta="0%p" android:toYDelta="-100%p"
android:duration="@android:integer/config_longAnimTime"/>
Just Change -100 to 100 (remove minus) in slide_out_up.xml
@Override
public void onBackPressed() {
finish();
overridePendingTransition(R.anim.enter_anim, R.anim.exit_anim);
}
这篇关于如何给从上到下动画的android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!