0

Is it possible to get the number of lines a TextView is capable of showing? I want to use it as a log view, adding new lines to the bottom and removing the oldest from the top...

1 Answer 1

7

refer these apis in TextView
getHeight
getLineHeight

Dividing the height by line height will give you the max number of lines possible.

Something like
(tv.getHeight() - tv.gettoppadding() - tv.getbottompadding())/tv.getLineHeight();

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.