protected void onDraw(Canvas canvas)
报错如下:
一开始还以为是模拟器的问题,结果发现:
//改变风格,绘制字体 paint.setTextSize(10); paint.setShader(null); canvas.drawText(getResources().getString(R.string.circle), 240, 50, paint); canvas.drawText(getResources().getString(R.string.square), 240, 120, paint); canvas.drawText(getResources().getString(R.string.rect), 240, 175, paint); canvas.drawText(getResources().getString(R.string.round_rect), 230, 220, paint); canvas.drawText(getResources().getString(R.string.oval), 240, 260, paint); canvas.drawText(getResources().getString(R.string.triangle), 240, 325, paint); canvas.drawText(getResources().getString(R.string.pentagon), 240, 390, paint);上面这些方法虽然不报错,但是如果上面的7个drawText方法只保留一个(不管是哪一个)的话,那么就可以运行,这个我也不知道为什么,还没解决