Skip to content Skip to sidebar Skip to footer

Android Drawable Marker With Bitmap Text Overlay Too Small

I am creating a Marker with text but the text is showing only 3 characters and very small and it is right of the bit map image. I want the text to go across the middle of the icon

Solution 1:

Here is the solution for the text overlay bound problem. Replace one line with all this lines:

// draw text to the Canvas center
  Rect bounds = new Rect();
  int x = (canvasBitmap.getWidth() - bounds.width())/2;
  int y = (canvasBitmap.getHeight() + bounds.height())/2;



// Draw the text on top of our image
//imageCanvas.drawText(text, width /4, height / 4, imagePaint); //OLD
imageCanvas.drawText(text, x , y, imagePaint); //NEW

Post a Comment for "Android Drawable Marker With Bitmap Text Overlay Too Small"