android在图像库上写文本

use*_*628 5 graphics fonts android

是否有任何库可以轻松地在图像的不同位置编写文本而无需执行大量数学运算?我需要在左上角的照片上写坐标。我现在看到的唯一方法是使用画布,但是它需要计算坐标,字体大小和其他内容。谢谢。

mdD*_*oid 0

尝试关注

Bitmap bitmap = ... // Load your bitmap here
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint(); 
paint.setColor(Color.BLACK); 
paint.setTextSize(10); 
canvas.drawText("Some Text here", x, y, paint);
Run Code Online (Sandbox Code Playgroud)

会帮助你

  • 我在我的文章中写过这种方式,这需要计算字体、坐标等。我问的是可以帮助简化此操作的库 (3认同)