Android Question GoogleMap marker icon is clipped

Discussion in 'Android Questions' started by MikeH, Jun 1, 2015.

  1. MikeH

    MikeH Well-Known Member Licensed User

    Does anyone know why:

    Mrk = Gmap.AddMarker3(x, y, Name, LoadBitmap(Dir, "icon.png"))
    Shows all of the marker icons like this: (Android)


    They should look like this: (iOS)


    These are the same two marker icons (one says OR, other says CR), above is Android, below is iOS.

    Thanks for your help :)
  2. Erel

    Erel Administrator Staff Member Licensed User

    What are the images sizes?
  3. MikeH

    MikeH Well-Known Member Licensed User

    They are downloaded as 20 x 20. It seems Google only allow use of 16 x 16.

    Edit: I tried 32 x 32 and that works perfectly. Maybe only multiples of 16 works?
    Last edited: Jun 1, 2015
  4. eurojam

    eurojam Well-Known Member Licensed User

    I think it is not a problem of the resolution. It seems more that the googlemaps api will not work with bitmaps properly. I have similar problems with an overlay. you can try to load them as a bitmap drawable. Put them into the res/drawable or drawable-hdpi folder as read only and then use some code like this one:
    Dim AndroidResources1 As AndroidResources
    Dim Icon1 As Bitmap
    Dim MyDrawable1 As BitmapDrawable
    Dim BitmapDescriptor1 As BitmapDescriptor
    Dim BitmapDescriptorFactory1 As BitmapDescriptorFactory
    Dim MarkerOptions1 As MarkerOptions
    "").Title("will see if it works...").Visible(True)
    Dim Marker1 As Marker=GoogleMapsExtras1.AddMarker(GoogleMap1, MarkerOptions1)
    Best regards
  5. MikeH

    MikeH Well-Known Member Licensed User

    Thanks Stefan, I did find that solution in another thread but these icons are downloaded and change from time to time so I can`t include them in the code.
  6. eurojam

    eurojam Well-Known Member Licensed User

    you can also try to make the bitmapdescriptor like this:
    BitmapDescriptor1=BitmapDescriptorFactory1.FromPath(aDir & "/icon.png")
  7. MikeH

    MikeH Well-Known Member Licensed User

    Thanks EJ, I tried that too, didnt work.

    I spoke to the place that provides the icons and asked them to change to 32 x 32 :)
  8. juventino883

    juventino883 Member Licensed User

    I have the same problem I scale the icon to 48x48 and the marker icon is clipped :s
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice