如何创建Marshmallow开放活动动画?

时间:2016-07-16 13:49:09

标签: android android-animation android-6.0-marshmallow

我正在写一个发射器。 如何开始显示Marshmallow动画的活动?

我查看了AOSP Launcher3源代码,发现只能使用它:

 if (useLaunchAnimation) {
            ActivityOptions opts = Utilities.isLmpOrAbove() ?
                    ActivityOptions.makeCustomAnimation(this, R.anim.task_open_enter, R.anim.no_anim) :
                    ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getMeasuredWidth(), v.getMeasuredHeight());
            optsBundle = opts.toBundle();
        }

然后被送入

startActivity(context, optsBundle);

task_open_enter动画如下所示:

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="#ff000000"
    android:shareInterpolator="false"
    android:zAdjustment="top">
    <alpha
        android:duration="167"
        android:fillAfter="true"
        android:fillBefore="true"
        android:fillEnabled="true"
        android:fromAlpha="0"
        android:interpolator="@interpolator/decelerate_quart"
        android:startOffset="0"
        android:toAlpha="1.0" />
    <translate
        android:duration="417"
        android:fillAfter="true"
        android:fillBefore="true"
        android:fillEnabled="true"
        android:fromYDelta="110%"
        android:interpolator="@interpolator/decelerate_quint"
        android:startOffset="0"
        android:toYDelta="0" />
</set>

不幸的是,这些与我正在寻找的Marshmallow动画不同,如下所示:

(gif减速3次)

Marshmallow Open Activity Animation

1 个答案:

答案 0 :(得分:3)

我在启动器源代码here中找到了答案:

import { bootstrap }    from '@angular/platform-browser-dynamic';

import { AppComponent } from './app.component';
import { appRouterProviders } from './app.routes';

bootstrap(AppComponent, [
    appRouterProviders
]);
相关问题