大家好:我正在编写一个继承自 TextView 的类,并覆盖其onDraw()
方法,但在该方法中,我的调用canvas.drawText()
似乎不起作用,代码如下所示:
protected void onDraw(Canvas canvas) {
// super.onDraw(canvas);
Paint paint = new Paint();
paint.setColor(android.graphics.Color.WHITE);
paint.setTextSize(20);
String text = "hello";
canvas.drawText(text, 0, 0, paint);
}