I have a TextView that is a single line. How can I add ellipses (...) if the text is too long?
This feature of the Text view upholds what type of content has to be shown to the user. For example, if there is a Heading, there are 6 types of heading that can be implemented have a look at the following image which contains the guidelines for the size of the text view and style of the text view which is recommended by Google’s Material Design.
If you use Abbreviation for Texting in your text message instead of full words then it will enhance your speed to infinity. If we use abbreviations in our text messaging it will help us to save our time and sending your message to another person Faster than a lengthy text.
And by the way, the correct terminology is “texting abbreviations”—you may have also seen “text abbreviations,” but this vaguer term is incorrect. Here’s a tip: Want to make sure your writing always looks great?
While we may not always use text abbreviations in real life or face-to-face conversations, they have become a language of their own in instant messaging and social media. Text abbreviations are shortened versions of commonly used words to help save characters in text messages, whereas acronyms are used to shorten entire phrases.
In your XML-file you can use: android:ellipsize="end"
.
In your .java code you can use:
yourTextView.setEllipsize(TextUtils.TruncateAt.valueOf("END"));
.
Remember to use it when you want ellipses if the text is reaching its parent's width.
Be aware of some issues by using the function: Android: Something better than android:ellipsize="end" to add "..." to truncated long Strings?
however, its still the most robust way to do it.
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