ConstraintLayout: What does `layout_constraintLeft_creator` do in xml?

点点圈 提交于 2019-12-09 02:26:25

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/40646131/constraintlayout-what-does-layout-constraintleft-creator-do-in-xml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!