Reputation:
I'm encountering an issue where the "Den Dolder"
TextView is always overlapping the date TextView. I have tried using app:layout_constraintRight_toLeftOf="@id/date_txtView"
but it has no effect surprisingly!
That's okay:
That's not okay:
Upvotes: 5
Views: 2127
Reputation: 7651
Short solution:
Try to add app:layout_constraintHorizontal_weight="1"
and android:layout_width="0dp"
to both of your textViews - they will both take the same width in the layout.
Another solution for more complicated layouts:
You need to tell both of your text views to be in a width of 0dp
, so they will drop a line if the text is too long.
For example, set a Chain between your 2 textViews like this:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
app:layout_constraintEnd_toStartOf="@+id/textView4"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="TextView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textView3"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
And it will look like this (no textView overlaps another one, they just drop down a line):
Upvotes: 2