Position view outside of ConstraintLayout
This appears to be an issue with ConstraintLayout
1.1.0-beta1; It works as expected in ConstraintLayout
1.1.0-beta3.
Update to ConstraintLayout
1.1.0-beta3. I will also note that you need to constrain your view horizontally by doing something like the following.
<View
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@color/colorPrimary"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toTopOf="parent" />
On a side note, negative margins are not accepted in ConstraintLayout
. See this Stack Overflow question regarding negative margins and ConstraintLayout
.
I got another way to solve the problem:
1.Add a anchor(anchor_left
) layout_constraintStart_toStartOf="parent"
.
2.Add YourView
layout_constraintEnd_toStartOf="@+id/anchor_left"
That's it!
code:
<android.support.constraint.ConstraintLayout>
<View
android:id="@+id/anchor_left"
app:layout_constraintStart_toStartOf="parent"/>
<YourView
android:id="@+id/ll_left"
app:layout_constraintEnd_toStartOf="@+id/anchor_left"/>
</android.support.constraint.ConstraintLayout>