我有一个自定义视图,可以在屏幕上绘制几个不同的东西。每个人都有自己的绘画对象。一切都画得很好,除了文字。它在 Gingerbread 中运行良好,但 ICS+ 没有文本。
这是我的绘制方法:
protected void onDraw(Canvas canvas)
{
canvas.save(Canvas.MATRIX_SAVE_FLAG);
canvas.scale(getWidth(), getHeight());
drawGrid(canvas);
drawHeader(canvas);
drawSelected(canvas);
drawDays(canvas);
drawToday(canvas);
canvas.restore();
}
Grid、Selected 和 Today 工作正常。Header 和 Days 是文本绘图,它们不起作用。
这是drawHeader方法:
private void drawHeader(Canvas canvas)
{
canvas.drawText("Sun", DAYS[0], .05f, paintDaysOfTheWeek);
canvas.drawText("Mon", DAYS[1], .05f, paintDaysOfTheWeek);
canvas.drawText("Tues", DAYS[2], .05f, paintDaysOfTheWeek);
canvas.drawText("Wed", DAYS[3], .05f, paintDaysOfTheWeek);
canvas.drawText("Thurs", DAYS[4], .05f, paintDaysOfTheWeek);
canvas.drawText("Fri", DAYS[5], .05f, paintDaysOfTheWeek);
canvas.drawText("Sat", DAYS[6], .05f, paintDaysOfTheWeek);
canvas.drawLine(.01f, .0f, .99f, .0f, paintMediumBlack);
canvas.drawLine(.01f, .07f, .99f, .07f, paintMediumBlack);
}
有任何想法吗?