Wrapping long text on an Android Canvas

后端 未结 3 1694
半阙折子戏
半阙折子戏 2020-12-15 18:30

I have a custom control that is doing a lot of 2D drawing straight to the canvas.

Some of this drawing is text, so I am using the Canvas.drawText() meth

3条回答
  •  粉色の甜心
    2020-12-15 19:13

    You can use Paint.getTextBounds() to measure the size of the entire string or Paint.getTextWidths() to get the width of each character. Then split the string appropriately before drawing it.

提交回复
热议问题