Reputation: 86
I try to render text to my canvas like in EditText render .
I found that sum of width of text in each line(display in EditText) may be greater or smaller than line width (getLineWidth) . I don't know why ?
=> I can't break line exactly like in EditText (100%) . How can i do that ?
Upvotes: 1
Views: 1096
Reputation: 1674
You can get the string value of each line. Then calculate the width.
String[] multiLines = stringFromEditText.split("\n");
// Get each line
String line0 = multiLines[0];
String line1 = multiLines[1];
String line2 = multiLines[2];
// Then get length of each line by str.length() or sth like that
Upvotes: 0