ConstraintLayout Guidelines Want Percentages Expressed as Decimal Value
I find it easy to forget that the “Guideline” element in a ConstraintLayout requires a value from 0 to 1 for its “layout_constraintGuide_percent” attribute:
<android.support.constraint.Guideline android:id="@+id/center_guideline" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:visibility="visible" app:layout_constraintGuide_percent="0.50" />
Don’t people usually think of numbers between 0 and 100 when they hear the word “percent”?
Android Studio 3.1.2’s layout designer does not seem to warn or complain if you use a value above 1 (e.g. “50”). But when I did that, the layout behaved unexpectedly.
Written on May 31, 2018