Home » Android » android – ConstraintLayout: What does `layout_constraintLeft_creator` do in xml?

android – ConstraintLayout: What does `layout_constraintLeft_creator` do in xml?

Posted by: admin April 23, 2020 Leave a comment

Questions:

Example code:

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

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

How to&Answers:

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.

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.