This example does not introduce any new knowledge. It only refers to the display of 256 characters per page on the screen. The "Left" and "right" arrow keys are used to flip the page.
The code for drawing each page is as follows:
[Java]
Private void drawChart (Canvas canvas, int base ){
Char [] chars = mChars;
For (int I = 0; I <256; I ++ ){
Int unichar = base + I;
Chars [I] = (char) unichar;
Canvas. drawText (Integer. toHexString (unichar ),
ComputeX (I), computeY (I), mLabelPaint );
}
Canvas. drawPosText (chars, 0,256, mPos, mBigCharPaint );
}
Private void drawChart (Canvas canvas, int base ){
Char [] chars = mChars;
For (int I = 0; I <256; I ++ ){
Int unichar = base + I;
Chars [I] = (char) unichar;
Canvas. drawText (Integer. toHexString (unichar ),
ComputeX (I), computeY (I), mLabelPaint );
}
Canvas. drawPosText (chars, 0,256, mPos, mBigCharPaint );
}
Use (char) to forcibly convert integers into characters, and then call drawPosText to draw strings.
Author: mapdigit