首页 > 其他分享 >Getting MAX_TEXTURE_SIZE from Caches::initConstraints()

Getting MAX_TEXTURE_SIZE from Caches::initConstraints()

时间:2022-11-24 17:03:31浏览次数:45  
标签:canvas string getString Getting MAX drawText TEXTURE paint getResources


在重写android中View类的onDraw方法画图的时候,

protected void onDraw(Canvas canvas)

报错如下:

Getting MAX_TEXTURE_SIZE from Caches::initConstraints()_android开发

一开始还以为是模拟器的问题,结果发现:


//改变风格,绘制字体
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方法只保留一个(不管是哪一个)的话,那么就可以运行,这个我也不知道为什么,还没解决


标签:canvas,string,getString,Getting,MAX,drawText,TEXTURE,paint,getResources
From: https://blog.51cto.com/u_15890522/5884215

相关文章