zoukankan      html  css  js  c++  java
  • Android 屏幕切换动画

    public void overridePendingTransition (int enterAnim, int exitAnim)

      Call immediately after one of the flavors of startActivity(Intent) or finish() to specify an explicit transition animation to perform next.

    As of JELLY_BEAN an alternative to using this with starting activities is to supply the desired animation information through a ActivityOptions 

    bundle or a related function. This allows you to specify a custom animation even when starting an activity from outside the context of the

    current top activity.

    1.左右滑动

    1.1 右进左出

    right_in.xml

    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android" >
        <translate
            android:duration="500"
            android:fromXDelta="100.0%p"
            android:toXDelta="0.0" />
        <alpha
            android:duration="500"
            android:fromAlpha="0.1"
            android:toAlpha="1.0" />
    </set>

    left_out.xml

    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android" >
        <translate
            android:duration="500"
            android:fromXDelta="0.0"
            android:toXDelta="-100.0%p" />
        <alpha
            android:duration="500"
            android:fromAlpha="1.0"
            android:toAlpha="0.1" />
    </set>

    1.2左进右出

    left_in.xml

    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android" >
        <translate
            android:duration="500"
            android:fromXDelta="-100.0%p"
            android:toXDelta="0.0" />
        <alpha
            android:duration="500"
            android:fromAlpha="0.1"
            android:toAlpha="1.0" />
    </set>

    right_out.xml

    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android" >
        <translate
            android:duration="500"
            android:fromXDelta="0.0"
            android:toXDelta="100.0%p" />
        <alpha
            android:duration="500"
            android:fromAlpha="1.0"
            android:toAlpha="0.1" />
    </set>

    2.上下滑动也一样

    3.关于设置动画值

    http://developer.android.com/guide/topics/resources/animation-resource.html#Twee

    <translate>

    A vertical and/or horizontal motion. Supports the following attributes in any of the following three formats:

    values from -100 to 100 ending with "%", indicating a percentage relative to itself;

    values from -100 to 100 ending in "%p", indicating a percentage relative to its parent;

    a float value with no suffix, indicating an absolute value.

  • 相关阅读:
    洛谷【P1480】A/B Problem
    bzoj 2654 && bzoj 3675 总结
    关于三维莫队问题的一些思考和探究
    BZOJ 1179 抢掠计划atm (缩点+有向无环图DP)
    BZOJ 1500 Luogu P2042 [NOI2005] 维护数列 (Splay)
    Codeforces 919D Substring (拓扑图DP)
    【学习笔记】有向无环图上的DP
    【学习笔记】求解简单递归式的一般方法
    BZOJ 3930 Luogu P3172 选数 (莫比乌斯反演)
    POJ 1061 BZOJ 1477 Luogu P1516 青蛙的约会 (扩展欧几里得算法)
  • 原文地址:https://www.cnblogs.com/yuyutianxia/p/3732192.html
Copyright © 2011-2022 走看看