How do I get the text that has been truncated by Android into an ellipsis?
I have a textview:
<TextView
android:layout_width="120dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="Um longo texto aqui de exemplo" />
On a device this TextView is shown like this:
"Um longo texto a..."
How do I get the rest of the text?
I am looking for something like getRestOfTruncate()
which would return "qui de exemplo".
String text = (String) textView.getText().subSequence(textView.getLayout().getEllipsisStart(0), textView.getText().length());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With