Reputation: 18509
i am drawing text on canvas using drawText() method.But when line is bigger then screen it is cutting text means if line is greater than screen size then it should come to new line,but it is not happening.Any help will be appreciated.
Upvotes: 1
Views: 459
Reputation: 688
Try:
mTextLayout = new DynamicLayout([charseq], paint, width,
Alignment.ALIGN_CENTER, 1.0f, 0.0f, false);
This will layout your text limited to a specific width.
Upvotes: 0
Reputation: 2804
The Canvas.drawText
methods do not automatically handle line-wrapping. You will have to do this yourself. You could try using the breakText methods in the Paint object—not sure if these break on word boundaries, or simply on whole characters.
Upvotes: 0
Reputation: 2797
What you are looking for is StaticLayout
.
You can use Android.text.StaticLayout
class and call it's draw(Canvas)
to draw text which wraps onto the next line.
Upvotes: 3