I have a textview between 2 other views inside a ConstraintLayout.
I set the text of the second one in the onViewCreated of my Fragment and later change it after some user input.
The first text works fine, but when i change it later i would expect its size to change with it, which of course would cause the view on its right to move a bit.
Instead the new text breaks down into 2 lines, when it's longer than the original...
How can i achieve that?
Here are the 3 Views:
<TextView
android:id="@+id/label"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_marginStart="24dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="24dp"
android:fontFamily="@font/hevetica_font"
android:gravity="center_vertical"
android:paddingStart="4dp"
android:paddingEnd="4dp"
android:text="@string/lbl"
android:textColor="@color/FlatWhite"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/topView" />
<TextView
android:id="@+id/text"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_marginStart="24dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="24dp"
android:fontFamily="@font/hevetica_font"
android:gravity="center_vertical"
android:paddingStart="4dp"
android:paddingEnd="4dp"
android:text=""
android:textColor="@color/FlatWhite"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintStart_toEndOf="@id/label"
app:layout_constraintTop_toBottomOf="@id/topView" />
<Button
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
app:layout_constraintStart_toEndOf="@id/label"
app:layout_constraintTop_toBottomOf="@id/topView"
android:text="change"
/>
and in the java code i change text using textView.setText(text);