Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActivityOptionsCompat.makeSceneTransitionAnimation with custom duration

I'm making a scene transition for devices with API level 20+. It is working fine, but I want to set custom duration to make the transition. Is it possible ??

My code:

ActivityOptionsCompat options =

                ActivityOptionsCompat.makeSceneTransitionAnimation(this,
                        viewStart,
                        transitionName
                );

        ActivityCompat.startActivity(this, detailsIntent, options.toBundle());
like image 254
Logic Avatar asked Mar 01 '16 05:03

Logic


1 Answers

You can set the desired duration in the new started activity, by adding:

    ChangeBounds bounds = new ChangeBounds();
    bounds.setDuration(2000);
    getWindow().setSharedElementEnterTransition(bounds);
like image 176
Victor Avatar answered Nov 03 '22 01:11

Victor