Search code examples
android-layoutandroid-constraintlayout

What is difference between Android widget position left and start (or right and end) for create Constraint?


For example, if i want to position button B to the right of button A.

enter image description here

Relative Positioning Constraints:

enter image description here

I can to use:

1)<Button android:id="@+id/buttonB" ... app:layout_constraintLeft_toRightOf="@+id/buttonA" />

Or

2)<Button android:id="@+id/buttonB" ... app:layout_constraintStart_toRightOf="@+id/buttonA" />

What is difference between example 1 and 2?

References: https://developer.android.com/reference/android/support/constraint/ConstraintLayout


Solution

  • There is no as such difference in both . As you can see in you image , they have mentioned above left as start and right as end .

    start and end was introduced in API level 17 What is the difference between Android margin start/end and right/left?

    Even if you try to use

    <Button android:id="@+id/buttonB" ...
                 app:layout_constraintStart_toEndOf="@+id/buttonA" />
    

    will result the same as

    <Button android:id="@+id/buttonB" ...
                 app:layout_constraintLeft_toRightOf="@+id/buttonA" />
    

    But i didn't find this constraint till now ... mixture of both start and right. Even this didn't appeared in xml .

    app:layout_constraintStart_toRightOf