什么是Android 4.0的活动之间的缺省过渡(API 14+) [英] What is the default transition between activities in Android 4.0 (API 14+)

查看:181
本文介绍了什么是Android 4.0的活动之间的缺省过渡(API 14+)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建有不少活动的应用程序,我想有右幻灯片进入由左退出/滑动它们之间的转换。

I built an application with quite a few activities and I would like to have "slide from right on enter/slide from left on exit" transitions between them.

我看了不止一次的幻灯片切换更多的应该是Android的默认,但在设备上,我就转变发展是淡出默认/淡出(Galaxy Tab的2 7,对ICS 4.0)。

I read more than once that slide transitions should be the Android default, but on the device I am developing on the transitions are fade in/fade out by default (Galaxy Tab 2 7", on ICS 4.0).

有什么我需要在应用程序级的清单文件中声明,例如?

Is there anything I need to declare at application level, for example in the manifest file?

我问,因为否则我会需要添加 overridePendingTransition(R.anim.right_slide_in,R.anim.left_slide_out); 来我的所有过渡这是很多.. 。只是想知道如果我才去这条道路缺少的东西。

I am asking because otherwise I would need to add overridePendingTransition (R.anim.right_slide_in, R.anim.left_slide_out); to all my transitions which are plenty...just wondering if I am missing something before going that road.

非常感谢

推荐答案

没有答案...... 4+我尝试在设备上,动画是淡入淡出与放大或缩小...

No answers...on the devices 4+ I tried, the animation is a fade-in fade-out with zoom in or out...

我手动添加code,其中我想有幻灯片动画:

I added the code manually where I wanted to have the slide animation:

//open activity
startActivity(new Intent(this, MyActivity.class));
overridePendingTransition(R.anim.right_slide_in, R.anim.left_slide_out);

XML动画从右至左:

xml animation right to left:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_decelerate_interpolator" >

<translate
    android:duration="300"
    android:fromXDelta="100%p"
    android:toXDelta="0" />

</set>

XML动漫左至右依次为:

xml animation left to right:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_decelerate_interpolator" >

<translate
    android:duration="300"
    android:fromXDelta="0"
    android:toXDelta="-100%p" />

</set>

这篇关于什么是Android 4.0的活动之间的缺省过渡(API 14+)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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