font diaplay half when TextView is too short
the textView's height and width is fixed.
when the len开发者_StackOverflowgth of string is longer than textview,the last-line text sometimes display half.
I want,when the last-line text can't display complete,discard it.how to realize?
It sounds to me like you already have ellipsize enabled, and that's why you're only getting "half" the last line.
Depending on what you're trying to achieve, you can-
- Remove ellipsize settings and suffer the string cut-off.
- Resize your textview so that all the text will fit.
- Change your font size so that all the text will fit.
StaticLayout has a way of detecting if the last line will cut off (using getEllipsisCount(line)) which is supposedly used internally by TextView, but I've had no luck using that to detect when a TextView is being cut off (see post).
If this doesn't help, please give us a better picture of what you're doing.
精彩评论