You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/theming/Motion.md
+22-79Lines changed: 22 additions & 79 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,9 +64,8 @@ Android structures including Fragments, Activities and Views.
64
64
65
65
### Container transform examples
66
66
67
-
<details>
68
-
<summary><b>Transition between Fragments</b></summary>
69
-
<br>
67
+
#### Transition between Fragments
68
+
70
69
In Fragment A and Fragment B's layouts, identify the start and end Views (as described in the [container transform overview](#material-container-transform)) which will be shared. Add a matching `transitionName` to each of these Views.
71
70
72
71
```xml
@@ -143,11 +142,8 @@ fun onCreate(savedInstanceState: Bundle?) {
143
142
exitTransition =Hold()
144
143
}
145
144
```
146
-
</details>
147
145
148
-
<details>
149
-
<summary><b>Transition between Activities</b></summary>
150
-
<br>
146
+
#### Transition between Activities
151
147
152
148
In Activity A’s layout, identify the start View to be used as the “shared element” as described in the [container transform overview](#material-container-transform). Give the start view a `transitionName`.
153
149
@@ -220,11 +216,7 @@ val options = ActivityOptions.makeSceneTransitionAnimation(
220
216
startActivity(intent, options.toBundle());
221
217
```
222
218
223
-
</details>
224
-
225
-
<details>
226
-
<summary><b>Transition between Views</b></summary>
227
-
<br>
219
+
#### Transition between Views
228
220
229
221
In the Activity or Fragment where you are transitioning between two views, trigger a `MaterialContainerTransform` by manually setting the transition’s start and end `View`s.
This will perform a container transform from the start view transitioning to the end view. To return, set up the same transform, switching the start and end Views and undoing any property changes (setting the FAB back to `View.VISIBLE` and the `bottomToolbar` back to `View.GONE`) done by the first transform.
253
-
</details>
254
245
255
246
### Customization
256
247
257
248
While the out-of-the-box container transform should work in most cases, you can manually set the following properties on `MaterialContainerTransform` to customize the look and feel of the animation:
@@ -294,7 +279,6 @@ has a different default value depending on whether or not the transition is
294
279
entering or returning._
295
280
296
281
_When you manually set any of the above properties, the value set will be used when the transition is both entering and returning (including when an enter transition is being re-used due to no return being set). If you need to manually set properties which differ depending on whether or not the transition is entering or returning, create two `MaterialContainerTransforms` and set both the `sharedElementEnterTransition` and `sharedElementReturnTransition`._
297
-
</details>
298
282
299
283
<br><br>
300
284
@@ -325,7 +309,7 @@ be changing in visibility or to be added or removed to trigger its animation.
325
309
direction. Below are the directions in which a `MaterialSharedAxis` will move
326
310
for both the forward and backward directions along each axis.
327
311
328
-
<summary><b>Shared axis</b> direction</summary>
312
+
#### Shared axis direction
329
313
330
314
Axis | Forward | Backward
331
315
----- | ----------------- | ------------------
@@ -338,9 +322,7 @@ Android structures including Fragments, Activities and Views.
338
322
339
323
### Shared axis examples
340
324
341
-
<details>
342
-
<summary><b>Transition between Fragments</b></summary>
343
-
<br>
325
+
#### Transition between Fragments
344
326
345
327
In the following example, we’re creating a shared axis Z transition between
346
328
FragmentA and FragmentB. Moving from FragmentA to FragmentB should be a
@@ -404,11 +386,8 @@ and Fragment B. Changing the axis to `MaterialSharedAxis.X` or
404
386
respective axis. Alternatively, try replacing `MaterialSharedAxis` with a
405
387
`MaterialFadeThrough` for a transition between destinations or layouts that are
406
388
_not_ spatially related.
407
-
</details>
408
389
409
-
<details>
410
-
<summary><b>Transition between Activities</b></summary>
411
-
<br>
390
+
#### Transition between Activities
412
391
413
392
Enable Activity transitions by either setting
414
393
`android:windowActivityTransitions` to true in your theme or enabling them on an
0 commit comments