Android Question Auto-adjusting text to image

adriano.freitas

Active Member
I need a Sub that receives a text (generally long and that can have line breaks), font size and an indicative number of width and generates an image with the text. The final image needs to have the informed width, and the height should be dynamically adjusted to contain all text. I've seen several examples here about converting text to image but none that I could adapt that way.

Can anyone help?

Thanks!
 

asales

Expert
Licensed User
Longtime User
I think you can use this approach:
- use scrollview in a panel to load a layout with the label
- get the height of the text with StringUtils.MeasureMultilineTextHeight
- adjust the scrollview/panel accordly the text height
- get a snapshot of the panel and save it into an image
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
review, it can give you an idea:
 
Upvote 0
Top