One would think that showing three dots in 2019 at the end of string will be easy, but the opposite seems to be true. I have tried:
maxLines="1"
drawablePadding="10dp"
ellipsize="end"
ellipsize="marquee"
singleLine="true"
layout_width="match_parent"
layout_width="wrap_content"
I went through dozens of questions here at stackoverflow, but it just doesn't work.
My layout file is quite simple:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/dialog_nearest_charger"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="40dp"
android:orientation="horizontal"
android:weightSum="10">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:minWidth="55dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/itemChargerDistance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textColor="@color/colorCoarseDistance"
android:textStyle="bold"
android:textSize="20sp"
android:text="1.2" />
<TextView
android:id="@+id/itemChargerUnits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textSize="12sp"
android:text="miles" />
</LinearLayout>
<ImageView
android:id="@+id/itemChargerOperator"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:minWidth="40dp"
android:layout_weight="1"
app:srcCompat="@drawable/dot_cpo_cps_copy_5" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="7dp"
android:layout_weight="2"
android:drawablePadding="10dp"
android:orientation="vertical">
<TextView
android:id="@+id/itemChargerTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="10dp"
android:ellipsize="end"
android:maxLines="1"
android:text="Kinross Park and Ride"
android:textSize="18sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/itemChargerAddress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="5dp"
android:textSize="14sp"
android:text="Junction Road" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
All I need is to show three dots when TextView itemChargerTitle
overflows. So far none of the solutions I found worked even in Android Studio preview.