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

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

问题描述

我想使用 Intent 从下到上从上到下显示一个活动

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

举个例子,如下所示

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天全站免登陆