How can I use Picasso and Google Marker Custom Icon to achieve this feature?
I know how to use Picasso for the image, but I don\'t know how to add that \"ma
here marker view is your custom marker layout
val view = LayoutInflater.from(context).inflate(R.layout.marker_view,
null,false)
val bitmap = getBitmapFromView(view)
// Uses a custom icon.
mSydney = mMap.addMarker(MarkerOptions()
.position(SYDNEY)
.title("Sydney")
.snippet("Population: 4,627,300")
.icon(BitmapDescriptorFactory.fromResource(bitmap)))
use this function to convert bitmap from view
private fun getBitmapFromView(view: View): Bitmap {
view.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED)
val bitmap = Bitmap.createBitmap(view.measuredWidth, view.measuredHeight,
Bitmap.Config.ARGB_8888)
val canvas = Canvas(bitmap)
view.layout(0, 0, view.measuredWidth, view.measuredHeight)
view.draw(canvas)
return bitmap
}