1

I use MapBox in Android and show some Points on it. Now I want to show a panel top-left of map and show some information in this panel. How can i do this? (An Example show in image in URL: https://docs.mapbox.com/help/img/directions/gljs-plugin.png , a panel like that panel show in image , the black panel on the left) Thanks

private MapView mapView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

    Mapbox.getInstance(this, YOUR_MAPBOX_ACCESS_TOKEN);

    setContentView(R.layout.activity_main);

    mapView = (MapView) findViewById(R.id.mapView);
    mapView.onCreate(savedInstanceState);
    mapView.getMapAsync(new OnMapReadyCallback() {
    @Override
    public void onMapReady(@NonNull MapboxMap mapboxMap) {

        mapboxMap.setStyle(Style.MAPBOX_STREETS, new Style.OnStyleLoaded() {
        @Override
        public void onStyleLoaded(@NonNull Style style) {

            // Map is set up and the style has loaded. Now you can add data or make other map adjustments



        }
    });
    }
});
Markus Kauppinen
  • 3,025
  • 4
  • 20
  • 30
Reza Dehghani
  • 15
  • 1
  • 6
  • you must create and feed data yourself – Radesh Feb 12 '19 at 08:40
  • @Radesh Thank you for your answer. But my question is, how do I put the desired panel on the map? – Reza Dehghani Feb 12 '19 at 09:03
  • The data you're seeing is coming from the Mapbox Directions API https://docs.mapbox.com/help/how-mapbox-works/directions/#mapbox-directions-api. When it comes to the actual views, there's no implementation ready out of the box, you'll need to build those views yourself. – Łukasz Paczos Feb 12 '19 at 14:16
  • @ŁukaszPaczos Thanks for your answer. That's exactly my question, how do I create this view and put it on the map ?! – Reza Dehghani Feb 13 '19 at 05:29
  • If you'd like it to truly be rendered by the map, you can prepare a custom Android View, generate a bitmap out of it and add it to the map on a `SymbolLayer`. Check out this example https://github.com/mapbox/mapbox-android-demo/blob/master/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/labs/SymbolLayerMapillaryActivity.java – Łukasz Paczos Feb 13 '19 at 14:12

0 Answers0