This repository was archived by the owner on Dec 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 173
XML to JSON and DSL for ConstraintSet attributes
John Hoford edited this page Jan 31, 2022
·
23 revisions
XML for ConstraintSet has many attributes because of the way XML works. Many of them have been combined for example android:layout_width, layout_constraintWidth, layout_constrainedWidth, layout_constraintWidth_min, layout_constraintWidth_max, layout_constraintWidth_percent, and layout_constraintDimensionRatio are all combined in width:
{
width: 23,
width: 'spread',
width: { value: 'wrap', max: 300 }
}
XML | JSON | DSL |
---|---|---|
android:orientation | 1* | |
android:id | 2* | createRefFor(...) |
android:visibility | visibility | |
visibilityMode | N/A | |
android:alpha | alpha | |
android:elevation | translationZ | |
android:rotation | rotationZ | |
android:rotationX | rotationY | |
android:rotationY | rotationX | |
android:scaleX | scaleX | |
android:scaleY | scaleY | |
pivotAnchor | TBD | |
android:transformPivotX | pivotX | |
android:transformPivotY | pivotY | |
transformPivotTarget | TBD | |
android:translationX | translationX | |
android:translationY | translationY | |
android:translationZ | translationZ | |
android:layout_width | width | height = |
android:layout_height | height | height = |
layout_constraintWidth | width | width = |
layout_constraintHeight | height | height = |
android:layout_marginStart | start | start.linkTo() |
android:layout_marginBottom | bottom | bottom.linkTo() |
android:layout_marginTop | top | top.linkTo() |
android:layout_marginEnd | end | end.linkTo() |
android:layout_marginLeft | left | left.linkTo() |
android:layout_marginRight | right | right.linkTo() |
layout_constraintCircle | circular | circular() |
layout_constraintCircleRadius | circular | circular() |
layout_constraintCircleAngle | circular | circular() |
layout_constraintGuide_begin | h/vGuideline | createGuidelineFromStart |
layout_constraintGuide_end | h/vGuideline | createGuidelineFromStart |
layout_constraintRight_toLeftOf | right | right.linkTo() |
layout_constraintGuide_percent | h/vGuideline | createGuidelineFromStart |
layout_constraintLeft_toLeftOf | left | left.linkTo() |
layout_constraintLeft_toRightOf | left | left.linkTo() |
layout_constraintRight_toRightOf | left | right.linkTo() |
layout_constraintTop_toTopOf | top | top.linkTo() |
layout_constraintTop_toBottomOf | top | top.linkTo() |
layout_constraintBottom_toTopOf | bottom | bottom.linkTo() |
layout_constraintBottom_toBottomOf | bottom | bottom.linkTo() |
layout_constraintBaseline_toBaselineOf | baseline | baseline.linkTo() |
layout_constraintBaseline_toTopOf | baseline | baseline.linkTo() |
layout_constraintBaseline_toBottomOf | baseline | baseline.linkTo() |
layout_constraintStart_toEndOf | start | start.linkTo() |
layout_constraintStart_toStartOf | start | start.linkTo() |
layout_constraintEnd_toStartOf | end | end.linkTo() |
layout_constraintEnd_toEndOf | end | end.linkTo() |
layout_goneMarginLeft | left | left.linkTo()* |
layout_goneMarginTop | top | top.linkTo()* |
layout_goneMarginRight | right | right.linkTo()* |
layout_goneMarginBottom | bottom | bottom.linkTo()* |
layout_goneMarginStart | start | start.linkTo()* |
layout_goneMarginEnd | end | end.linkTo()* |
layout_goneMarginBaseline | baseline | baseline.linkTo()* |
layout_marginBaseline | baseline | baseline.linkTo()* |
layout_constrainedWidth | width | width = |
layout_constrainedHeight | height | height = |
layout_constraintHorizontal_bias | hBias | linkTo() |
layout_constraintVertical_bias | vBias | linkTo() |
layout_constraintWidth_default | width | width = |
layout_constraintHeight_default | height | height = |
layout_constraintWidth_min | width | width = |
layout_constraintWidth_max | width | width = |
layout_constraintWidth_percent | width | width = |
layout_constraintHeight_min | height | height = |
layout_constraintHeight_max | height | height = |
layout_constraintHeight_percent | height | height = |
layout_constraintDimensionRatio | height/width | ???? |
layout_constraintHorizontal_weight | ??? | |
layout_constraintVertical_weight | ??? | |
layout_constraintHorizontal_chainStyle | hChain | createHorizontalChain() |
layout_constraintVertical_chainStyle | vChain | createVerticalChain() |
layout_wrapBehaviorInParent | ??? | |
barrierDirection | v/hBarrier* | createStartBarrier |
barrierMargin | v/hBarrier* | createStartBarrier |
constraint_referenced_ids | (used in all helpers) | |
constraint_referenced_tags | ||
android:maxHeight | height: { max: 300 } | |
android:maxWidth | width: { max: 300 } | |
android:minHeight | height: { min: 300 } | |
android:minWidth | width: { min: 300 } | |
barrierAllowsGoneWidgets | v/hBarrier* | createStartBarrier* |
chainUseRtl | Not implemented | createHorizontalChain() |
animateRelativeTo | MotionLayout* | |
animateCircleAngleTo | MotionLayout* | |
transitionEasing | MotionLayout* | |
pathMotionArc | MotionLayout* | |
polarRelativeTo | MotionLayout* | |
transitionPathRotate | MotionLayout* | |
drawPath | MotionLayout* | |
motionProgress | Not implemented | |
layout_constraintTag | code only | |
motionStagger | MotionLayout* | |
quantizeMotionSteps | MotionLayout* | |
quantizeMotionPhase | MotionLayout* | |
quantizeMotionInterpolator | MotionLayout* |
1* - By convention helpers will be explicetly vertical or horizontal (vBarrier or hBarrier)
2* - The id is usually the lable
MotionLayout* - These features of MotionLayout are not implemented.
Helpers flow,barrier are not implemented