Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Marker view adapter layout needs a view parent to anchor correctly #6805

Closed

Description

@cammace

When inflating a custom layout in a marker view, the layout must have a view parent to anchor itself correctly, otherwise the marker moves depending on the zoom and never reaches to correct given position.

In both GIFs you'll notice both a cat marker (custom layout marker) and a default marker using the same position. I'm centering both the markers using 0.5f, 0.5f for the anchor value.

Without view parent:

ezgif com-video-to-gif 1

With view parent:

ezgif com-video-to-gif

cc: @mapbox/android

Activity

  1. added
    Android
    on Oct 24, 2016
  2. dylan-chong commented on Nov 25, 2016

    @dylan-chong

    For me, I was using my own MarkerViewAdapter that uses an ImageView, and had a sort of similar problem (also same problem when using the MarkerViewManager.ImageMarkerViewAdapter class): When the creating a new marker (inside the getView method of the adapter) the position is offset, but when I am able to reuse the convertView in getView, then the position is fine.

    Do you have something similar if you say: create the cat, wait a second, remove the cat, then create the cat marker again.

  3. Guardiola31337 commented on Jun 21, 2017

    @Guardiola31337
    Contributor

    Hey 👋 @dylan-chong
    First of all, thanks a lot for reaching out and report your problem.

    This should be fixed with #9282. Feel free to test out the latest 5.1.0-beta.5 or the SNAPSHOT to verify if it's fixed.

  4. Guardiola31337 commented on Jun 21, 2017

    @Guardiola31337
    Contributor

    Going ahead and closing here.

    @dylan-chong thanks again for using Mapbox and feel free to open new tickets if you find any other issues 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Android

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions