进出动漫发行的Andr​​oid幻灯片幻灯片、进出、动漫、Andr

由网友(the sunshine、那抹阳光)分享简介:我的活动成功的Andr​​oid 4.1的活动幻灯片使用动画为B My Activity Successfully slide in android 4.1 from Activity A to B using animation **inamation.xml**<?xml version="1.0" encod...

我的活动成功的Andr​​oid 4.1的活动幻灯片使用动画为B

My Activity Successfully slide in android 4.1 from Activity A to B using animation

**inamation.xml**

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="100%"
android:toXDelta="0%"
android:duration="600" />
</set>

outanimation.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="100%"
android:toXDelta="0%"
android:duration="600" />
</set>

和活性的我用overidding未决的过渡,如下图所示:

and in activity A i used overidding pending transition as shown below:

A.this.overridePendingTransition(R.anim.outanimation,R.anim.inanimation);

A.this.overridePendingTransition(R.anim.outanimation,R.anim.inanimation);

由于前面说的这个正常工作的安卓4.0及以上平台,但是当我 在Android 2.3平台上测试了一下,活动A到B获取Android的默认行为的动画。

as said earlier this works fine on android 4 and above platform but when i test it on android 2.3 platform, Activity A to B gets android default activity animation.

我怎么能运行我的活动滑动从左到右,从右到左是2.2及以上版本兼容。

how can i run my activity to slide left to right and right to left which is compatible with 2.2 and above.

有没有办法通过编程设置两个活动之间的动画?

更新

的问题是,该装置,至少在三星Galaxy的情况下,必须启用这个工作动画。这可以在设置菜单来完成。的

The problem was that the device, at least in the case of Samsung Galaxy, has to have animations enabled for this to work. This can be done in the settings menu.

你知道如何激活的设置菜单上的所有动画的Andr​​oid?

推荐答案

有关Android的幻灯片和退出动画,我有以下使用code。

For Android Slide in and out animation, I have use following code.

活动答:

Intent intnt = new Intent(SplashScreen.this,
                        CustomTabActivity.class);
                startActivity(intnt);
                overridePendingTransition(R.anim.slide_in_left,
                        R.anim.slide_out_left);
                finish();

slide_in_left.xml

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="@android:integer/config_longAnimTime"
    android:fromXDelta="100%p"
    android:toXDelta="0%p" />

slide_out_left.xml

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="@android:integer/config_longAnimTime"
    android:fromXDelta="0"
    android:toXDelta="-100%p" />
阅读全文

相关推荐

最新文章