How to get the maximum number of lines that can be written in TextView? I tried this:
DisplayMetrics metrics = new DisplayMetrics ();
getWindowManager (). getDefaultDisplay (). getMetrics (metrics);
float width = metrics.widthPixels;
float height = metrics.heightPixels;
int lines = (int) (height / textView.getLineHeight ());
System.out.println (lines);
However, this variant gives the wrong information.
textview.getLineCount()
It's all in the documentation
EDIT: I was a bit too fast. I assume you want the number of lines that CAN be inside a textview instead of how many there currently ARE in the textview... In that case -> have a look at this question: Calculate text size according to width of text area