-1

I am adding a custom marker to my map with code

marker =new MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.bus)));

but it appears too large and covers the whole screen

enter image description here

how to solve this issue.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

1 Answers1

2

you can resize programmatically

Solution 1:

        int height = 100;
        int width = 100;
        BitmapDrawable bitmapdraw=(BitmapDrawable)getResources().getDrawable(R.drawable.bus);
        Bitmap b=bitmapdraw.getBitmap();
        Bitmap smallMarker = Bitmap.createScaledBitmap(b, width, height, false);

        MarkerOptions marker =   new MarkerOptions()
                .title("Your title")
                .icon(BitmapDescriptorFactory.fromBitmap(smallMarker));
        googleMap.addMarker(marker);

Solution 2:

Simple you need to Change your Image into Small size.

Gowthaman M
  • 8,057
  • 8
  • 35
  • 54