I've been working on this issue for a few hours now and am at a loss.
I have an item in a recyclerview (orientation horizontal) that with which I have a paragraph of text. I'm expecting the text to ellipsize at the end of where it would fit into the TextView, but instead it gets cut off in a weird place:
I've tried setting the description view to a fixed height, used wrap_content
, changed to use maxLines
, lines
and all of them produce the same effect and do not ellipsize the text. Does anyone know what I'm doing wrong with this?
The code for this row is:
<?xml version="1.0" encoding="utf-8"?>
<layout 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">
<data>
<variable
name="point"
type="uk.geekhole.visum.database.models.BasePoint" />
</data>
<androidx.cardview.widget.CardView
android:layout_width="250dp"
android:layout_height="260dp"
android:layout_marginStart="18dp"
android:layout_marginEnd="9dp"
android:elevation="0dp"
app:cardCornerRadius="15dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="0dp"
android:scaleType="centerCrop"
app:imageUrl="@{point.imageUrls[0]}"
app:layout_constraintBottom_toBottomOf="@id/title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:background="@android:color/holo_red_dark"
tools:src="@drawable/app_logo" />
<View
android:id="@+id/background"
android:layout_width="match_parent"
android:layout_height="105dp"
android:background="@drawable/background_near_me_row"
app:layout_constraintBottom_toBottomOf="parent" />
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="18dp"
android:layout_marginEnd="20dp"
android:ellipsize="end"
android:maxLines="1"
android:text="@{point.name}"
android:textColor="@color/text_colour_near_me_title"
android:textSize="@dimen/text_size_normal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/background"
tools:text="Wollaton Hall" />
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="20dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="10dp"
android:ellipsize="end"
android:text="@{point.description}"
android:textColor="@color/text_colour_near_me_description"
android:textSize="@dimen/text_size_smaller"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/title"
tools:text="In the heart of nottingham this stunning park will leave you speechless, with breathtaking views from outside the hall, to the intriguing curiosities inside. Fun for all ages!" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</layout>