Hi I have a layout with three TextViews. One of them on the left (numPreguntaTv) and the others two on the right (enunciadoPregTv and tipoPregItemTv), one above of the other.
I want the numPreguntaTv to have the height of two lines, so when enunciadoPregTv has two lines, it must has the same height of numPreguntaTv on the left. Also, if enunciadoPregTv has only one line, then tipoPregItemTv must fit in the second line.
I would like to have them align perfectly (or almost).
Right now they are like this:
If enunciadoPregTv has two or more lines, its fine, it seems to have the same height than numPreguntaTv. However if enunciadoPregTv only has one line, then tipoPregItemTv doesn't fit the second line properly. It is a bit below.
How can I accomplish my idea?
This is my layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/numPreguntaTv"
android:layout_width="52dp"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-smallcaps"
android:text="10"
android:textAlignment="textEnd"
android:textColor="@color/azul"
android:textSize="48sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/enunciadoPregTv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginTop="4dp"
android:justificationMode="inter_word"
android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque in finibus purus. Curabitur ex nisi, aliquam nec turpis quis, mollis consequat diam. In felis nibh, fringilla nec mi eu, tempus iaculis nulla."
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/numPreguntaTv"
app:layout_constraintTop_toTopOf="@+id/numPreguntaTv" />
<TextView
android:id="@+id/tipoPregItemTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="56dp"
android:text="Verdadero o falso"
android:textStyle="italic"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/enunciadoPregTv" />
<com.google.android.material.button.MaterialButton
android:id="@+id/borrarPregButton"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center_horizontal"
android:layout_marginEnd="8dp"
app:backgroundTint="@color/rojo"
app:icon="@drawable/ic_baseline_delete_24"
app:iconGravity="textStart"
app:iconPadding="0dp"
app:layout_constraintEnd_toStartOf="@+id/editarPregButton"
app:layout_constraintTop_toBottomOf="@+id/tipoPregItemTv" />
<Button
android:id="@+id/editarPregButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/editar_pregunta_button"
app:icon="@drawable/ic_baseline_edit_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tipoPregItemTv" />
</androidx.constraintlayout.widget.ConstraintLayout>
Thank you!!