How can I set a "layout_marginLeft(/Right)" from Constraint Layout Editor?

851 Views Asked by At

I have a app with minSdk=15.

I am trying to migration to ConstraintLayout.

almost ok. but when I change the value of margin_left from layout editor, layout_marginLeft/Right attrubute is removed.

before

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="24dp" 
        android:layout_marginStart="24dp" // <- I will set to 16dp from layout editor
    />

after

<TextView
    android:layout_width="0dp"
    android:layout_height="wrap_content"
                                      // <- layout_marginLeft is removed...
    android:layout_marginStart="16dp" // <- it is ok
    />

expected behavior

if I change marginLeft from layout editor,

layout_marginLeft/Right and layout_marginStart/End is changed.

update

I set the value from below

enter image description here

success change layout_margineStart/End, but layout_marginLeft/Right is removed.

or

enter image description here

value is rejected and layout_marginLeft/Right is removed.

1

There are 1 best solutions below

4
On

I don't how you are changing it, but in my case it is not happening.

Second thing is that why you want to set left and right. you should use start and end.

Still you want to set left and right margin you can do it from attribute tab with click on "view all attribute".


You can add it like below

oenter image description here

click on tool enter image description here(specify design property) button after that you can add it.

like I did it for left margin.

one cache is that it is only for design perspective. it will add tools:layout_margineLeft not android:layout_margineLeft which you needed