I'm trying to write some strings to a canvas (live wallpaper) however long string don't get word-wraped is there any way to do it?
I think canvas is the only thing I can use for this, since it's a live wallpaper.
No need to do your own word wrapping.
Check out android.text.Layout and its subclasses android.text.StaticLayout and android.text.DynamicLayout
something like this:
StaticLayout layout = new StaticLayout(text, txtpaint, textW,Layout.Alignment.ALIGN_NORMAL, 1.3f, 0, false);
txtcanvas.translate(xoffs, yoffs); //position the text
layout.draw(txtcanvas);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With