2

I'm using a view and drawing over a bitmap some text,it does not have a fixed size, so I want the text to fit the rectangle I define and if it's needed split the string in some lines. I don't know how to do it in android. I found one solution using StaticLayout, but doesn't work. Here is my code:

Bitmap arBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ar_bitmap);
canvas.drawBitmap(arBitmap ,bitmapPos,20,  null);ll);
Paint paint = new Paint(); 
paint.setStyle(Paint.Style.FILL); 
paint.setColor(Color.WHITE);
canvas.drawText(textToDisplay,textPos , 35, paint);

Thanks

dakshbhatt21
  • 3,558
  • 3
  • 31
  • 40
Alex
  • 31
  • 2
  • 4

0 Answers0