从下到上显示活动 [英] Display Activity From Bottom to Top

查看:35
本文介绍了从下到上显示活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 Intent 从下到上显示一个 activity 到另一个动画.

I want to display one activity to another from bottom to top animation using Intent.

给我一​​些像下面这样的例子

Given me some example for that like below

Intent i2 = new Intent(main.this, test.class);
startActivity(i2);

动画从下到上.

推荐答案

在 res/anim/slide_in_up.xml 中定义动画:

Define an animation in res/anim/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"/>

另一个在 res/anim/slide_out_up.xml:

and another at res/anim/slide_out_up.xml:

<?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"/>

然后在调用 startActivity 之后应用这些:

Then apply these after to call startActivity:

Intent i2 = new Intent(main.this, test.class);
startActivity(i2);
overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up );

此处介绍了 Android 动画,可能会对您有所帮助.

There an introduction to Android animation here which may help you further.

这篇关于从下到上显示活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆