When using TextView, you need to automatically display an ellipsis for an extended length, and there are native support in Android, defined as follows:
Copy Code code as follows:
<textview ...
Android:ellipsize= "End"
Android:singleline= "true"/>
A look really can be used, but carefully observed, found in the ellipsis ... There is a box behind, similar to the appearance of garbled characters, this is why?
The original Android ellipsize when processing strings, if found that the string is too long, it will replace the last character to ..., not three points, but the font built-in ellipsis. No matter what font you use, you need to support this ellipsis to display correctly. The app uses a Mercedes font that supports the ellipsis display, and there's no problem here. The problem is that Android, when dealing with ellipsize, replaces one character with ..., replacing the remaining truncated characters with the Unicode character "ZERO WIDTH no-break Space" (U+feff), which is not displayed on the screen, But it's still part of the string.
The problem originally out here, the use of Mercedes font does not support this special character U+feff display, it will appear garbled. The solution is also very simple, edit the font file, the U+feff the width of this character is set to 0.