@@ -15,7 +15,7 @@ them, check out the
1515[ Material motion system spec] ( https://material.io/design/motion/the-motion-system.html ) .
1616
1717Before you can use the motion library, you need to add a dependency on the
18- Material Components for Android library (version ` 1.2.0-beta01 ` or later). For
18+ Material Components for Android library (version ` 1.2.0-rc01 ` or later). For
1919more information, go to the
2020[ Getting started] ( https://github.com/material-components/material-components-android/tree/master/docs/getting-started.md )
2121page.
@@ -156,16 +156,46 @@ transition to the the provided `Hold` transition.
156156
157157``` kt
158158// FragmentA.kt
159- override fun onCreate (savedInstanceState : Bundle ? ) {
159+ fun onCreate (savedInstanceState : Bundle ? ) {
160160 super .onCreate(savedInstanceState)
161161
162162 // Fragment A’s exitTransition can be set any time before Fragment A is
163- // replaced withFragment B. Ensure Hold's duration is set to the same
163+ // replaced with Fragment B. Ensure Hold's duration is set to the same
164164 // duration as your MaterialContainerTransform.
165165 exitTransition = Hold ()
166166}
167167```
168168
169+ Alternatively, to subtly scale and fade Fragment A while the container transform
170+ is playing, set FragmentA's exit and reenter transitions to a
171+ ` MaterialElevationScale ` transition. This will help to reinforce the spatial
172+ relationship and navigational hierarchy of the two screens along the z-axis.
173+
174+ ``` kt
175+ // FragmentA.kt
176+ fun onCreate (savedInstanceState : Bundle ? ) {
177+ super .onCreate(savedInstanceState)
178+
179+ exitTransition = MaterialElevationScale (/* growing= */ false )
180+ reenterTransition = MaterialElevationScale (/* growing= */ true )
181+ }
182+ ```
183+
184+ We pass in ` false ` for the exit ` MaterialElevationScale ` ` growing ` constructor
185+ param, to scale down or shrink Fragment A when it is exiting during the enter
186+ container transform. Whereas we pass in ` true ` for the reenter
187+ ` MaterialElevationScale ` to scale up or expand Fragment A when it is reentering
188+ during the return container transform.
189+
190+ _ ** Note:** When using ` MaterialElevationScale ` , make sure to mark the root view
191+ of your Fragment as a
192+ [ transition group] ( https://developer.android.com/reference/android/view/ViewGroup#setTransitionGroup\( boolean\) ) ,
193+ either with ` android:transitionGroup="true" ` for API level 21+ or
194+ ` ViewGroupCompat#setTransitionGroup ` for all API levels. This will ensure that
195+ the animation is applied to the Fragment view as a whole, as opposed to each
196+ child view individually, which is the default behavior of the Android
197+ Transitions system._
198+
169199#### Transition between Activities
170200
171201_ ** Note:** Activity and Window transitions require using Android Framework
0 commit comments