Introduction to minor issues about Android ellipsize

Source: Internet
Author: User

When using TextView, The ellipsis is automatically displayed if the length is too long. native support is available in android, which is defined as follows: Copy codeThe Code is as follows: <TextView...
Android: ellipsize = "end"
Android: singleLine = "true"/>

It can be used at first glance, but after careful observation, it is found that the ellipsis... There is a box behind it, similar to the garbled characters. Why?

When ellipsize in android was used to process strings, if it was found that the string was too long, it would replace the last character ..., It is not three vertices, but the ellipsis embedded in the font. No matter what font is used, you must support this ellipsis to display it correctly. The font used by the APP is Mercedes, which supports ellipsis display. There is no problem here. The problem is that when android processes ellipsize, it replaces a character ..., Replace the remaining truncated characters with the Unicode Character "zero width no-break space" (U + FEFF), which is not displayed on the screen, but it is still part of the string.

The problem originally exists here. The Mercedes font used does not support the display of this special character U + FEFF, so garbled characters will appear. The solution is also very simple. Edit the font file and set the width of the U + FEFF character to 0.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.