I have a TextView which should display a maximum of 2 lines of text and the rest should be ellipsized(if that's the right term)
Here's what I'm doing
android:ellipsize="end"
android:maxLines="2"
android:singleLine="false"
But the text isn't getting cut off at the end as expected.
Here's my code:
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp">
<TextView
android:id="@+id/note_priority"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:paddingLeft="10dp"
android:text="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<TextView
android:id="@+id/note_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/note_priority"
android:singleLine="true"
android:text="TitleTitleTitleTitleTitleTitleTitleTitleTitleTitle"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<TextView
android:id="@+id/note_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/note_title"
android:ellipsize="marquee"
android:maxLines="2"
android:singleLine="false"
android:text="DescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescription" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
EDIT: I have already tried using end and marquee both as the value for android:ellipsize