I want to created a wrapping text ontop of google maps api. I have been able to do this with a lot of code, but have been working on a better way. My latest attempt is to use the StaticLayout class and the text is wrapping, but I do not know how to position it...no matter what I try it is always starting in the top left corner of the screen....
try doing a canvas.translate(x,y)
before you call draw(c)
on the layout.
You can do it as follows
//Save canvas before translating it, otherwise restore will cause crash (Underflow in restore - more restores than saves)
canvas.save()
canvas.translate(xPos, yPos);
statictextlayout.draw(canvas);
//After that to reset the canvas back for everything else
canvas.restore();
To continue drawing normally afterwards... call canvas.restore() after you staticlayout draw and you should be good to continue drawing on you canvas.
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