Android Question Google Map Marker icon Chopped

iCAB

Well-Known Member
Licensed User
Longtime User
Hi All

While trying to scale the Marker icon to look bigger on a tablet, I ran into an issue where the Marker icon look chopped ( only a small part of it shows ).

The code below shows the working code followed by the code that will cause the issue.

B4X:
    Dim BitmapDescriptor1 As BitmapDescriptor
    Dim BitmapDescriptorFactory1 As BitmapDescriptorFactory

        'This code works ok  
    BitmapDescriptor1=BitmapDescriptorFactory1.FromAsset(TLocalMarker.TMarkerSettings.IconFile)
    MarkerOptions1.Icon(BitmapDescriptor1)
  
        'This code shows chopped icons
    'Dim bBitMap As Bitmap = LoadBitmap(File.DirAssets, TLocalMarker.TMarkerSettings.IconFile)
    'BitmapDescriptor1=BitmapDescriptorFactory1.FromBitmap(bBitMap)
    'MarkerOptions1.Icon(BitmapDescriptor1)

Can someone clarify please

Thanks in advance
 

iCAB

Well-Known Member
Licensed User
Longtime User
You should use different icons (with different sizes) and always use 160 as the multiplier.

Thanks Erel for the suggestion, but I was trying to avoid this in the first place as there are many different types of icons used in our case.

I was hoping for a solution that I can use without having to recreate the icons...


Thanks for the help
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
Create a single large image and resize it at runtime with CreateBitmapScaled.

The original issue was encountered with CreateScaledBitmap, that's when you recommended to use SetBitmapDensity

Don't worry about it at this point, you have more important things to do for all of us. I will use different icon sizes.

Thank you for the exceptional support
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…