5

I want to set a icon for a marker, but it is too big so i want to scale it down.

MapFragment.this.map.addMarker(new MarkerOptions().position(new LatLng(lat, lng))
.icon(BitmapDescriptorFactory.fromResource(R.drawable.guest_icon)));
user3260664
  • 145
  • 1
  • 3
  • 9
  • You are better served by searching for this on your own. This question has been answered many times on this discussion portal. How about making some effort on your own rather waiting for a served answer. – Parth Kapoor Apr 14 '14 at 14:22

1 Answers1

2

This is a duplicate question. See: Change marker size in Google Maps API v2

Simply put, resize the bitmap prior to passing it to the MarkerOptions object you're creating, referencing the newly sized image. It's also worth noting that if it's a fairly large resource, you might want to do the resizing in an AsyncTask or another thread. See this thread for an example: Android , createScaledBitmap slow when creating multiple bitmaps

Community
  • 1
  • 1
Grant Amos
  • 2,256
  • 17
  • 11