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 A
  • 2,112
  • 2
  • 24
  • 31
  • Could you post a screenshot how it currently looks like? –  Jan 09 '17 at 16:15
  • Just the map comes up, with invisible boxes. I know they're there because I can tap on them and get the tooltip. – David A Jan 09 '17 at 18:11
  • Ok, I figured it out, have to use drawColor without the PorterDuff part canvas1.drawColor(Color.WHITE); – David A Jan 09 '17 at 18:55

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.