moagrius / TileView

TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images. Plugins are available for features like markers, hotspots, and path drawing.
MIT License
1.46k stars 337 forks source link

Can not add marker to tileview when I add tileview to a RelativeLayout #446

Closed oceanpad closed 6 years ago

oceanpad commented 6 years ago

I have a android app used tileview plugin. At first, I create a tileview, then I add the tileview to a relativeLayout part. And I want add marker to the tileview. But When I use addMarker function, The marker not appear on tileview part.

    int width = 1230;
    int heigt = 500;
    TileView tileView = new TileView( this );
    tileView.setSize(width, heigt);
    tileView.addDetailLevel(1, "map_02_107.jpg", width, heigt);
    tileView.defineBounds(0, 0, 0, 0);
    tileView.setShouldRenderWhilePanning( true );

    tileView.setScaleLimits(0, 1);
    tileView.setScale(1f);
    tileView.setShouldRenderWhilePanning( true );
    tileView.setMarkerAnchorPoints(-0.5f, -0.5f);

    String title = "t";
    CircleView tagView = (CircleView) 
    LayoutInflater.from(this).inflate(R.layout.tag_view, null);
    tagView.setTitleText(title);
    tileView.addMarker( tagView, 0.24, 0.5, null, null );

    tileViewRelativeLayout.addView(tileView);