I have a StaticLayout that AbsoluteSizeSpan is applied for each line. How to get size of lines in this layout?
Asked
Active
Viewed 242 times
1 Answers
0
try this
private int charPerLine(TextView textView){
String s = "";
for (int i = 0; i <= 1000; i++) {
s+="X";
if(isTooLarge(textView,s)){
return i;
}
}
return 1000;
}
private boolean isTooLarge (TextView textView, String text) {
float textWidth = textView.getPaint().measureText(text);
return (textWidth >= textView.getMeasuredWidth ());
}

Mojtaba jalambadani
- 92
- 1
- 6