Kurlicue Kurlicue - 11 months ago 38
Java Question

Check if a string is too big to fit in a TextView

I have an editText, a TextView and a button. I want to check whether the String from EditText is too big or not to fit the TextView, if not I want to append "..." to the string, so if I write "That's a nice coat" and that's too big to fit in the textView it shows "That's a ni...". I can't add more lines to the textView to make it fit.


Just use maxLines=1 and ellipsize=end in your TextView

if in code, use mText.setEllipsize(TextUtils.TruncateAt.END)