Using the ConstraintLayout
I have 2 TextView
that I want to be next to each other when their is enough space to see the content of both. But if TextView A takes a lot of space and fullfill all the screen width, than I would like that TextView B goes under TextView A instead of still being on the right but invisible (out of the screen).
So with the code below I got my 2 TextView
right next to each other.
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/text_view_a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="8dp"
tools:text="a very long text ..." />
<TextView
android:id="@+id/text_view_b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
app:layout_constraintLeft_toRightOf="@+id/text_view_a"
app:layout_constraintTop_toTopOf="parent"
tools:text="some text" />
</android.support.constraint.ConstraintLayout>
How should I edit this code snippet so that TextView B goes under TextView A if their isn't any space left for him?