有人在L上成功使用过setExitTransition吗?

Ale*_*van 6 mobile android android-transitions android-5.0-lollipop

我一直在尝试使用L开发人员预览版附带的新奇特动画,但我遇到了很多困难.特别是,我没有看到任何花哨的动画.我正在尝试使用爆炸退出过渡.这是代码:

public class ActivityA extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // inside your activity
        getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);

        // set an exit transition
        getWindow().setExitTransition(new Explode());
        setContentView(R.layout.activity_a);

        // Find our button and add our click handler
        Button button = (Button)findViewById(R.id.buttonA);
        button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                // Transition to activity B
                Intent intent = new Intent(ActivityA.this, ActivityB.class);
                startActivity(intent);
            }
        });
    }
}
Run Code Online (Sandbox Code Playgroud)

Har*_*h_N 12

而不是startActivity(intent);使用以下语句启动另一个活动.

startActivity(intent,ActivityOptions.makeSceneTransitionAnimation(this).toBundle());
Run Code Online (Sandbox Code Playgroud)

如上所述,我开始了另一项活动,它对我有用.

在谷歌文档中定义自定义动画如下所述.

在此输入图像描述