I have a Textview in one of the layouts to show email address. So for long email addresses the text should show ellipsis at the end and for that I have added below attributes in TextView
android:ellipsize="end"
android:maxLines="1"
xml:
<TextView
android:id="@+id/email"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="16dp"
android:layout_weight="1"
android:ellipsize="end"
android:lineSpacingExtra="4dp"
android:maxLines="1"
tools:text="abcabc.abcabc.100000000000000000000000000000000000000000000000000@abcabcabcabcabcabc.com" />
This works well except for one scenario where the email address has any numbers in it and a dot before the numbers for eg.
abcabc.abcabc.100000000000000000000000000000000000000000000000000@abcabcabcabcabcabc.com
For above email address the ellipsis is shown before max limit like so,
If there is no dot before the numbers then ellipsis is shown properly at the end
abcabc.abcabc100000000000000000000000000000000000000000000000000@abcabcabcabcabcabc.com
I am using Samsung galaxy Tab A having API 22.
Not sure why the ellipsis is shown before max limit for first scenario, how can we resolve this?