I have a TextView
to the right of an image. I am trying to place some long text next to the image but this text should automatically end by adding "..." at the end. However, this does not work. I use this layout:
<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="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp">
<ImageView
android:id="@+id/file_icon"
android:layout_width="250px"
android:layout_height="250px"
android:layout_gravity="center"
android:clickable="true"
android:scaleType="centerInside"
android:src="@drawable/ic_launcher"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/file_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="This is a very long title and I hope I have the dots to break it"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/file_type"
app:layout_constraintVertical_chainStyle="packed"
app:layout_constraintStart_toEndOf="@+id/file_icon"
app:layout_constraintWidth_default="wrap"/>
<TextView
android:id="@+id/file_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Type"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/file_title"
app:layout_constraintLeft_toRightOf="@+id/file_icon" />
<ImageView
android:id="@+id/file_download"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:clickable="true"
android:scaleType="centerInside"
android:src="@drawable/ic_action_download"
app:layout_constraintTop_toBottomOf="@+id/file_title"
app:layout_constraintRight_toRightOf="parent" />
The result is this:
Why does the long text not ellipsize such that "..." appears at the end? I have read this and this post but it does not work for me. Can anyone help me here?