Search code examples
androidtextviewellipsis

No text, only ellipsize


In Constarint layout I have two TextViews one beside another, horizontaly. And if the first TextView is too long the second one disapears. It's ok, but the second TextView leaves ellipsize, no text.

<TextView
    android:id="@+id/full_name"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:ellipsize="end"
    android:gravity="start"
    android:maxWidth="@dimen/profile_connections_name_size"
    android:maxLines="1"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"/>

<TextView
    android:id="@+id/user_name"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginStart="12dp"
    android:ellipsize="end"
    android:gravity="start"
    android:maxLines="1"
    app:layout_constraintBottom_toBottomOf="@id/full_name"
    app:layout_constraintEnd_toEndOf="parrent"
    app:layout_constraintHorizontal_bias="0"
    app:layout_constraintStart_toEndOf="@id/full_name"/>

Here you can see how it looks like: https://i.sstatic.net/9Gcla.png


Solution

  • adding android:singleLine="true" helped me :)