Search code examples
javaandroidandroid-studioandroid-constraintlayout

ConstraintLayout strange constraint lines


I'm using a constraint layout, as i understood it would make the UI look similar on different screen sizes. The problem is that I cannot drag a constraint line from a calendat view to a textView

So therefor I created the constraint line I needed using

app:layout_constraintBottom_toTopOf="@+id/appfortday"

picture: https://i.sstatic.net/ecxY9.jpg

and it created this weird wiggly line instead of a nomral zig-zag line. What is the difference between these lines? Will it behave as a normal constraint line?

here is a part of my xml:

<CalendarView
    android:id="@+id/calendarView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/textcalender"
    android:layout_marginTop="56dp"
    app:layout_constraintBottom_toTopOf="@+id/appfortday"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.0"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/textcalender" />

<TextView
    android:id="@+id/appfortday"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="10dp"
    android:text="Appointments for today"
    android:textSize="15dp"
    app:layout_constraintBottom_toTopOf="@+id/feelingsrec"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.2"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/calendarView"
    app:layout_constraintVertical_bias="0.49" />

I would like to know the difference between these lines and if it would affect the way my UI will look on different screen sizes. Thanks


Solution

  • The "wiggly" line indicates, that the two views have constraints pointing at each other.

    calendarView has a constraint to the top of appfortday and vice versa.

    This is OK. If you have views which have constraints that point at each other, you can change how they are aligned by adding chain styles.