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.
精彩评论