Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

increase shared element transition speed

I have implemented shared element image transition with recycler view and its working fine. The issue is that i want to increase its image transition speed like google photo app have. Can we do this programmetically ? I'm sharing few lines of code.

Start Activity

    Intent intent = new Intent(StartActivity.this, TargetActivity.class);

                intent.putExtra(KEY_EXTRA_IMAGES_URLS, urls);
                ActivityOptionsCompat options = ActivityOptionsCompat.
                        makeSceneTransitionAnimation(StartActivity.this, view,
getResources().getString(R.string.transition_name_profile_image));
                ActivityCompat.startActivity(StartActivity.this, intent, options.toBundle());
like image 680
JosephM Avatar asked Oct 06 '16 09:10

JosephM


People also ask

How do shared element transitions work?

A shared element transition determines how a view that is shared between two fragments moves between them. For example, an image displayed in an ImageView in fragment A transitions to fragment B once B becomes visible.

Which of the following transitions is a shared elements transition?

Android also supports these shared elements transitions: changeBounds - Animates the changes in layout bounds of target views. changeClipBounds - Animates the changes in clip bounds of target views. changeTransform - Animates the changes in scale and rotation of target views.


1 Answers

You can change the transition time in your activity as:

    getWindow().setSharedElementEnterTransition(new ChangeBounds().setDuration(2000));
like image 197
M.Waqas Pervez Avatar answered Sep 24 '22 02:09

M.Waqas Pervez