When you open another activity and want to have a small picture (a view) inside a button animate to a big profile picture. That picture is called shared element.
- Create a
Scenethat holdsviewandtransitionName. Pack them insideBundleand send it to anotherActivity. The destination view's xml must haveandroid:transitionNameattribute.
Intent intent = new Intent(context, AnotherActivity.class);
ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation(context, Pair.create(originView, "btnTransition"));
startActivity(intent, optionsCompat.toBundle());<...
android:transitionName="btnTransition"
.../>