1

I want to add custom marker to google map. i have a picture of marker which i want to add which is

https://i.stack.imgur.com/AB5bb.png

I need to paste/draw circle image in center of this marker

How can i do it?

UPD:

//downloaded circle image
public Bitmap getCroppedBitmap(Bitmap bitmap) {
    Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
            bitmap.getHeight(), Config.ARGB_8888);
    Canvas canvas = new Canvas(output);

    final int color = 0xff424242;
    final Paint paint = new Paint();
    final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());

    paint.setAntiAlias(true);
    canvas.drawARGB(0, 0, 0, 0);
    paint.setColor(color);
    // canvas.drawRoundRect(rectF, roundPx, roundPx, paint);
    canvas.drawCircle(bitmap.getWidth() / 2, bitmap.getHeight() / 2,
            bitmap.getWidth() / 2, paint);
    paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
    canvas.drawBitmap(bitmap, rect, rect, paint);
    //Bitmap _bmp = Bitmap.createScaledBitmap(output, 60, 60, false);
    //return _bmp;
    return output;
}  
//Draw Marker
public Bitmap pinMarker(Bitmap bitmap) {
    Bitmap.Config conf = Bitmap.Config.ARGB_8888;
    Resources res = context.getResources();
    Bitmap bmp = BitmapFactory.decodeResource(res, R.drawable.ic_pin_map);
    Canvas canvas1 = new Canvas(bmp.copy(conf, true));

    // paint defines the text color,
    // stroke width, size
    Paint color = new Paint();
    color.setTextSize(35);
    color.setColor(Color.BLACK);

    //modify canvas
    canvas1.drawBitmap(getCroppedBitmap(bitmap), 0,0, color);

    return bmp;
}

But it doesnt work. i see just empty marker on map

Ilnar Karimov
  • 339
  • 2
  • 6
  • 19

0 Answers0