I'm trying to set ellipsis to the end of my text(multi-line) if the text is too long.
I already know I can use setMaxLines() and setEllipsize() to achieve the effect. However, since my textview's size is dynamically changeable, I don't know the max number of lines that can be displayed. Instead I have the textview's height (by pixel).
How do I set ellipsis based on the height of the view and the text(includes font properties)? If no direct available resource I can use, what could be the easiest possible approach?
You can use getLineCount() (but only after a layout pass).
See this answer for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With