Hey there- I’m creating a Live Wallpaper which includes text that is drawn directly to the canvas via a TextPaint and DynamicLayout object. Within my DynamicLayout Object I set the width to the canvas width, and am now looking for a way to wrap the text that extends past the canvas. Here is my text set up code:
//token is my large text string
TextPaint tp = new TextPaint();
Layout sl = new DynamicLayout(token, tp, (int) canvasWidth, Layout.Alignment.ALIGN_NORMAL, 0, 0, true);
canvas.translate(startPositionX , startPositionY);
sl.draw(canvas);
How do I wrap this text if it extends past the canvasWidth? Any help is appreciated!
Got this after a few hours… looking to StringTokenizer, finding the longest word from my string and wrapping the remaining text to that width.