0

I'm trying to have a canvas with one bg color but it's not working. I can probably create an array of same color and a bitmap but would like to avoid that if possible. RE: Android canvas change background color

 private void addCustomMarker(GoogleMap map, ActivePoint a, LatLng latLng) {
        Bitmap.Config conf = Bitmap.Config.ARGB_8888;
        Bitmap userBmp = Utils.decode(a.mCreatorUser.getmImgBase64Thumb());
        Bitmap dogBmp = Utils.decode(a.mCreatorDog.getmImgBase64Thumb());

        int border_width = 10;

        int width, height = 0;
        width = userBmp.getWidth() + dogBmp.getWidth();
        height = userBmp.getHeight() > dogBmp.getHeight() ? userBmp.getHeight() : dogBmp.getHeight();
        Bitmap cs = Bitmap.createBitmap(width+border_width*2, height+border_width*2, Bitmap.Config.ARGB_8888);

        Canvas canvas1 = new Canvas(cs);

    // modify canvas

        canvas1.drawARGB(0, 0x3F, 0x51, 0xB5);
//        canvas1.drawColor(ContextCompat.getColor(this,R.color.primary), PorterDuff.Mode.CLEAR);

// add marker to Map
        map.addMarker(new MarkerOptions().position(latLng)
                .icon(BitmapDescriptorFactory.fromBitmap(cs))
                // Specifies the anchor to be at a particular point in the marker image.
                .snippet(a.mId)
                .anchor(0.5f, 1));
    }
Community
  • 1
  • 1
David Aleksanyan
  • 2,953
  • 4
  • 29
  • 39

1 Answers1

0

The PorterDuff.Mode.CLEAR makes it transparent, that's why you don't see them while they are on the map, remove that argument.