80,359
社区成员
发帖
与我相关
我的任务
分享
/**
* Draw the text, with origin at (x,y), using the specified paint. The
* origin is interpreted based on the Align setting in the paint.
*
* @param text The text to be drawn
* @param x The x-coordinate of the origin of the text being drawn
* @param y The y-coordinate of the origin of the text being drawn
* @param paint The paint used for the text (e.g. color, size, style)
*/
public void drawText(String text, float x, float y, Paint paint) {
native_drawText(mNativeCanvas, text, 0, text.length(), x, y, paint.mBidiFlags,
paint.mNativePaint);
}
@Override
protected void onDraw(Canvas canvas) {
canvas.save();
float px = getWidth() / 2;
float py = getHeight() / 2;
float radius = Math.min(px, py);
canvas.drawCircle(px, py, radius, paint);
for (int i = 0; i <= 3; ++i) {
canvas.drawText(i + "", px - textWidth / 2, py - radius , textPaint);
canvas.rotate(90, px, py);
}
canvas.restore();
super.onDraw(canvas);
}