Recent work in business has met the needs of Android readers. The first question is how to divide a novel into content that needs to be displayed on each page, depending on the size of the screen. To put it simply, the string of a whole novel becomes a string["string that is exactly what each page can display."
First, we want to get the wide-height--width,height of the display area.
Then, the number of rows that can be displayed on a screen rowcount the current font size is calculated.
Next, set the font size, alignment
New Paint (paint.anti_alias_flag); Mpaint.settextalign (Paint.Align.LEFT); Mpaint.settextsize (14);
Next, remove the first paragraph:
int paragraphend = str.indexof ("\ n") ; = str.substring (0, Paragraphend);
And get the first line to show how many words:
int true NULL ); LOG.D ("tag", "The End index is =====" + breakindex); = Str.substring (Breakindex);
If this paragraph is finished, remove the paragraph; If this page ends and the paragraphs are still not displayed, the remaining strings will be spelled back to the original content for display.
This completes the basic idea of a reader page display.
Done.
The idea of Android Reader (i)