Ellipsize is mainly when the TextView text is too long, we can let it display the ellipsis
Use the following:
in XML
<!--ellipsis at the end -android:ellipsize = "End"<!--ellipsis at the beginning -android:ellipsize = "Start"<!--ellipsis in the middle -android:ellipsize = "Middle"<!--Racing Lights -android:ellipsize = "marquee"<!--It's best to add a constraint line display -android:singleline = "true"<!--You can also set the maximum length of the text, reaching this length to start using ellipses -android:maxwidth= "90DP"
Set in code
Tv.setellipsize (TextUtils.TruncateAt.valueOf ("END")); Tv.setellipsize (TextUtils.TruncateAt.valueOf(" START ")); Tv.setellipsize (TextUtils.TruncateAt.valueOf (" Middle ")); Tv.setellipsize ( TextUtils.TruncateAt.valueOf ("MARQUEE")); // It is best to add one more constraint tv.setsingleline (true); Tv.setmaxwidth (100);
Ellipsize-textview ellipsis setting