There should be a lot of TextView used in Android development. Many times, TextView will have a line that is not completely intercepted or will be wrapped. Before my solution is clumsy, fixed dead textview line word length, the last one by ellipsis instead, this will have a lot of problems, the adaptation of Android phone is a headache problem. And the Chinese characters and English symbols occupy a different width, more headache. Find a way to be more simple and share. Android provides the Setellipsize method for TextView, which can help us save a lot of trouble. The specific practice is as follows:
textview.setellipsize (textutils.truncateat. MARQUEE);//have
Start end Middle Marquee parameter
Textview.setsingleline (TRUE);//Set as single-line
Textview.setmarqueerepeatlimit (6);//number of rolling cycles
Public static Finaltextutils.truncateatEND omitted
public static final textutils.truncateat marquee scrolling
public static final textutils.truncateat middle Middle omitted
public static final textutils.truncateat start
Start omitting
If I want to be the lowest, I can do this:
Setellipsize (TextUtils.TruncateAt.END);
But remember to set TextView as a single line. Android:singleline= "True" can be set in XML
Android TextView Display Incomplete auto-complement mode