从左到右,从右到左,从动画的Andr​​oid 2.1及以上 [英] Left to Right and Right to Left Animation from Android 2.1 and above

查看:136
本文介绍了从左到右,从右到左,从动画的Andr​​oid 2.1及以上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

传递动画在Android 2.1至4.2是非常怪异的机器人。在code在我的动画文件夹下找到行之有效的在Android 4.0及以上版本。我还没有与第3版进行了测试,但我最小的SDK版本是2.1,这些动画不会进行这项工作。是否有关于实施动画在Android 2.1版本兼容到2.3,或者我应该执行我的动画编程的一个问题。我的目标是从左至右,从右到左,以切换活动。

Transitive animation on android 2.1 to 4.2 is very weird in android. The code below found in my anim folder works well on android 4.0 and above version. i have not tested it with version 3. But my minimum sdk version is 2.1, these animation does not work on it. Is there an issue on implementing animation on android compatible with version 2.1 to 2.3 or should i implement my animation programatically. My aim is to switch activity from left to right and right to left.

动画/ anim_left.xml

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

    <translate
        android:duration="2000"
        android:fromXDelta="50%p"
        android:interpolator="@android:anim/linear_interpolator"
        android:toXDelta="0" />

    <alpha
        android:duration="1000"
        android:fromAlpha="0.0"
        android:interpolator="@android:anim/linear_interpolator"
        android:toAlpha="1.0" />
</set>

动画/ anim_right.xml

推荐答案

您可以做到这一点编程:例如:

You can achieve this programatically: for example:

TranslateAnimation slide = new TranslateAnimation(0, 0, 0, -1*screenHeight(this));   
             slide.setDuration(1000);

                // slide.setFillAfter(true);   
                chargement_rel.startAnimation(slide); 
                slide = new TranslateAnimation(0, 0, screenHeight(this), 0);   
                slide.setDuration(1000);   
               // slide.setFillAfter(true);   
                chargement_rel.startAnimation(slide);

这篇关于从左到右,从右到左,从动画的Andr​​oid 2.1及以上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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