如何从Constraint Layout Editor设置“layout_marginLeft(/ Right)”?

问题描述 投票:2回答:1

我有一个minSdk = 15的应用程序。

我正在尝试迁移到ConstraintLayout。

差不多好但是当我从布局编辑器更改margin_left的值时,将删除layout_marginLeft / Right attrubute。

之前

    <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
    />

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

expected behavior

如果我从布局编辑器更改marginLeft,

layout_marginLeft / Right和layout_marginStart / End已更改。

update

我从下面设置了值

enter image description here

成功更改layout_marginStart / End,但删除了layout_marginLeft / Right。

要么

enter image description here

值被拒绝,layout_marginLeft / Right被删除。

android android-layout android-studio android-layout-editor
1个回答
0
投票

我不知道你是如何改变它的,但就我而言,它并没有发生。

第二件事是你想要左右设置的原因。你应该使用开始和结束。

您仍然希望设置左右边距,您可以通过单击“查看所有属性”从属性选项卡执行此操作。


您可以像下面一样添加它

uggs

点击工具enter image description here(指定设计属性)按钮后,您可以添加它。

就像我为左边距做的那样。

一个缓存是它仅用于设计透视。它会添加工具:layout_margineLeft而不是android:layout_margineLeft你需要它

© www.soinside.com 2019 - 2024. All rights reserved.