constraintlayout icon indicating copy to clipboard operation
constraintlayout copied to clipboard

layout_constraintWidth/Height_percent="1" not works in layoutDescription XML files

Open h6ah4i opened this issue 4 years ago • 4 comments

In a layout XML file, specifying layout_constraintWidth_percent="1" / layout_constraintHeight_percent="1" (and also > 1.0) works as expected. ​

However, in a layoutDescription XML file layout_constraintWidth_percent="1" / layout_constraintHeight_percent="1" (and also > 1.0) does not work well and seems completely ignored.


  • ConstraintLayout version: 2.1.0

h6ah4i avatar Aug 09 '21 09:08 h6ah4i

Where did you find the definition of layout_constraintWidth ? What do you think it should do width ="1"?

jafu888 avatar Aug 12 '21 23:08 jafu888

Where did you find the definition of layout_constraintWidth ?

Sorry, that was my mistake. I mean layout_constraintWidth_percent and layout_constraintHeight_percent.

What do you think it should do width ="1"?

  • layout_constraintWidth_percent="0" :point_right: it means 0 % of the parent (MotionLayout) width.
  • layout_constraintWidth_percent="0.5" :point_right: it means 50 % of the parent (MotionLayout) width.
  • layout_constraintWidth_percent="0.999" :point_right: it means 99.9 % of the parent (MotionLayout) width.
  • layout_constraintWidth_percent="1" :point_right: it should be 100 % of the parent (MotionLayout) width.

NOTE: I've also fixed the description of the issue.

h6ah4i avatar Aug 13 '21 12:08 h6ah4i

Ok sorry I got confused with the layout_constraintWidth which is a different attribute. Looking into it.

jafu888 avatar Aug 13 '21 17:08 jafu888

Any news?

I've faced the same issue with layout_constraintWidth_percent values more than 1, like layout_constraintWidth_percent="1.4".

Perfomer avatar Oct 04 '21 07:10 Perfomer