简体   繁体   中英

Rounded google maps custom marker android

I want to add a custom marker that looks like this: 内有图像且四舍五入的标记

How can I achieve this? I am using Glide and Picasso libraries.

You can use MarkerOptions

MarkerOptions markerOptionsObj = new MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.Your_Icon));

https://developers.google.com/maps/documentation/android-api/marker

if you are using Picasso to download/load the pictures, then you can use a Transformation to intercept the bitmap and make it rounded. The callback gives you the bitmap to transform. You can easily use a BitmapShader with the TileMode.CLAMP to make it round

要在地图中添加自定义标记,可以使用以下代码行:

MarkerOptions markerOptions = new MarkerOptions().icon(yourBitmap);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM