title: Autofit text in a rectangle on android
body: <p>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:</p>
  
  <pre><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);
  </code></pre>
  
  <p>Thanks</p>