I have created a layout with two textviews to display some content with text selection enabled. While try to ellipsize text, it does't work. If I disable the text selection, ellipsize works as expected. How to ellipsize text with text selection enabled?
And also, while adding paddingRight attribute to first textview (textview1), second textview (textview2) gets truncated at firstline eventhough I configured ellipize as "end". How to resolve the first line truncate issue?
XML layout file:
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:id="@+id/textview1"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:includeFontPadding="false"
android:paddingRight="15dp"
android:singleLine="true"
android:text="Single Line 123456789 123456789"
android:textColor="#f00"
android:textIsSelectable="true"
android:textSize="16dp" />
<TextView
android:id="@+id/textview2"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:ellipsize="end"
android:includeFontPadding="false"
android:maxLines="2"
android:text="MultiLine123456789123456789123456789123456789 123456789123456789123456789"
android:textColor="#000"
android:textIsSelectable="true"
android:textSize="16dp" />
</LinearLayout>
Thank you for any help you can offer.