Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/221.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Android L动画在活动之间切换_Android_Android Layout_Android Animation_Material Design - Fatal编程技术网

使用Android L动画在活动之间切换

使用Android L动画在活动之间切换,android,android-layout,android-animation,material-design,Android,Android Layout,Android Animation,Material Design,如何使用一些Android L动画在活动之间切换?我只能找到有关的信息 在Android开发者文档中,我找不到关于收件箱和设置活动之间的以下动画的任何文档 我已经从Gmail中提取了动画文件,但是当使用以下内容时,活动只会上下滑动,没有Z移动(深度) 你可以找到使用的动画文件。看起来Gmail使用类来创建动画,所以我必须创建自己的版本 swap\u-in\u-bottom.xml <?xml version="1.0" encoding="utf-8"?> <set xmln

如何使用一些Android L动画在活动之间切换?我只能找到有关的信息

在Android开发者文档中,我找不到关于收件箱和设置活动之间的以下动画的任何文档

我已经从Gmail中提取了动画文件,但是当使用以下内容时,活动只会上下滑动,没有Z移动(深度)


你可以找到使用的动画文件。

看起来Gmail使用类来创建动画,所以我必须创建自己的版本

swap\u-in\u-bottom.xml

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

    <alpha
        android:duration="150"
        android:fromAlpha="0.0"
        android:toAlpha="1.0" />

    <translate
        android:duration="200"
        android:fromYDelta="100.0%p"
        android:toYDelta="0.0" />

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

    <scale
        android:duration="200"
        android:fromXScale="1.0"
        android:fromYScale="1.0"
        android:pivotX="50%p"
        android:pivotY="50%p"
        android:toXScale="0.9"
        android:toYScale="0.9" />

    <alpha
        android:duration="200"
        android:fromAlpha="1.0"
        android:toAlpha="0.5" />

    <translate
        android:duration="400"
        android:fromYDelta="0.0"
        android:interpolator="@android:anim/accelerate_interpolator"
        android:startOffset="100"
        android:toYDelta="20.0%p" />

</set>
以及使用它的代码

 overridePendingTransition(R.anim.swap_in_bottom, R.anim.swap_out_bottom);
下面是我的自定义动画的外观(在设备上更平滑)


请发布R.anim。我已将anim文件夹附加到帖子中。@Jack Wilsdon但我们如何做到自上而下而不是自下而上呢?你能帮忙吗?
 overridePendingTransition(R.anim.swap_in_bottom, R.anim.swap_out_bottom);