本文介绍了ConstraintLayout:layout_constraintLeft_creator在xml中做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

示例代码:

 <EditText
        android:id="@+id/msg_type"
        android:layout_width="0dp"
        android:layout_height="40dp"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:hint="Input message"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="0.75"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toLeftOf="@+id/btn_chat_send"
        tools:layout_constraintBottom_creator="1"
        tools:layout_constraintLeft_creator="1"
        tools:layout_constraintRight_creator="1"/>

tools:layout_constraintRight_creator="1"在这里做什么?没有任何文件解释这些事情.

What does tools:layout_constraintRight_creator="1" do here? There aren't any document explaining these things.

推荐答案

对于上下文-这些是工具属性-纯粹是为了在Studio中帮助版本.当您将APK推送到设备时,这些属性实际上会被删除.

For context -- those are tools attributes -- they are purely here to help the edition in studio. Those attributes actually are stripped out when you push an APK to your device.

现在,ConstraintLayout中的* _creator属性使我们能够轻松跟踪是否手动创建了这些约束(0)或通过推理引擎(1)创建了这些约束.如果是后者,并且您再次单击推断,我们知道我们可以安全地删除这些约束并重新计算新的约束.

Now, the *_creator attributes in ConstraintLayout simply allow us to keep track if you created those constraints manually (0) or via the inference engine (1). If it's the latter and you click again on inference, we know we can safely remove those constraints and recompute new ones.

因此,基本上,如果您对布局感到满意,则可以将其删除.但是当它们推入设备时,它们已经被删除.

So basically if you are happy with your layout, you could remove them. But they are already removed when pushed on device.

这篇关于ConstraintLayout:layout_constraintLeft_creator在xml中做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 20:16