flow_horizontalAlign

flow_verticalAlign

flow_verticalAlign

android:orientation = “horizontal|vertical” (default horizontal)

(default horizontal) app:flow_horizontalStyle = "spread|spread_inside|packed" (default spread)

(default spread) app:flow_verticalStyle = "spread|spread_inside|packed" (default spread)

(default spread) app:flow_horizontalBias = "float" (default 0.5)

(default 0.5) app:flow_verticalBias = "float" (default 0.5)

(default 0.5) app:flow_horizontalGap = "dimension" (default 0)

(default 0) app:flow_verticalGap = "dimension" (default 0)

(default 0) app:flow_horizontalAlign = "start|end|center" (default center)

(default center) app:flow_verticalAlign = "top|bottom|center|baseline” (default center)

(default center) app:flow_maxElementsWrap = "integer" (default : 0, not applied)

New features of MotionLayout We also added several new features to MotionLayout.

Auto Transition

Transitions can be made to automatically fire when MotionLayout reaches a state associated with that transition. Transitions can be made to automatically fire when MotionLayout reaches a state associated with that transition.

none - default value no transitions automatically

animateToStart - animate to the start state if you are at the end state

animateToEnd - animate to the end state if you are at the start state

jumpToEnd - Jump to the start state if you are at the start state

jumpToStart - Jump to the end state if you are at the end state

These can be combined to allow jumping to the end but smooth transition to the start.



< Transition motion :constraintSetStart ="@+id/end" motion :constraintSetEnd ="@+id/b" motion :autoTransition ="animateToEnd" motion :motionInterpolator ="easeIn" motion :duration ="1000" />



Derived Constraints

Constraint sets can now be derived from other constraints sets. This can greatly reduce xml size. In a <ConstraintSet> can now have an attribute deriveConstraintsFrom which allows you to specify the id of another constraint set. This is useful for generating a series of constraints that only have small variations between them.



Note: These can be combined to allow jumping to the end but smooth transition to the start.Constraint sets can now be derived from other constraints sets. This can greatly reduce xml size. In a can now have an attribute deriveConstraintsFrom which allows you to specify the id of another constraint set. This is useful for generating a series of constraints that only have small variations between them.Note:

A constraint set represents the complete set of constraints for a layout

This works well in conjunction with the newer PropertySet, Layout, Transform syntax

All ConstraintSets derive from from the MotionLayout by default



<!-- Content of layout file --> < ConstraintSet android :id ="@+id/base" > </ ConstraintSet >

<!-- Layout file but override visibility of region1 (region1 now gone ) --> < ConstraintSet android :id ="@+id/state1" > < Constraint android :id ="@id/region1" > < PropertySet motion :visibility ="gone" /> </ Constraint > </ ConstraintSet >

<!-- State1 (above) but override visibility of region2 (both region1 & region2 gone) --> < ConstraintSet android :id ="@+id/state2" motion :deriveConstraintsFrom ="@id/state1" > < Constraint android :id ="@id/region2" > < PropertySet motion :visibility ="gone" /> </ Constraint > </ ConstraintSet > OnSwipe regions

OnSwipe now takes an attribute touchRegionId which limits the starting point of the bounds of that view.



Note:

The view pointed to by the id can be invisible

can be invisible Quite often the region is the same as the anchor.

This allows two Transition swipes to be in effect in the same direction normally each transition is in a different direction.



< OnSwipe motion :dragDirection ="dragDown" motion :touchAnchorId ="@+id/region2" motion :touchRegionId ="@+id/region2" motion :touchAnchorSide ="top" /> Swipe without autocomplete

OnSwipe Automatically completes the transition choosing the direction and animating smoothly to a stop. Sometimes this feature is not desired and can be turned off.



You can use this to implement things like a custom slider.

< OnSwipe motion :dragDirection ="dragRight" motion :autoComplete ="false" motion :touchAnchorId ="@+id/button" motion :touchAnchorSide ="right" />

OnSwipe now takes an attribute touchRegionId which limits the starting point of the bounds of that view.Note:OnSwipe Automatically completes the transition choosing the direction and animating smoothly to a stop. Sometimes this feature is not desired and can be turned off.You can use this to implement things like a custom slider.

The way elements are positioned for the other orientation is controlled byandattributes. For example, if specifying a horizontal orientation, useto control the vertical positioning of the elements being laid out.