Set map to transparent

Hi all,

I’m developping an application where I display the path between two point on a map using Arcgis. By clicking on the Path Details, you can access a new interface.

On this new interface, with some text and image, there is a floating button to display the geometric of the path on the screen, but with a transparent background, so we can still be able to see the interface behind.

I figured that the easyest way to do so would be to display a mapview and graphics on top of the interface, and then make ONLY the map transparent, keeping the graphics and the interface on the screen.

How can I mke the map transparent, but still display the graphics on the screen ?

Hi Thomas,

Before we start answering your question, can we check your implementation. Is this built using Esri-leaflet or native ArcGIS SDK?

Kai Cong

This is built using native ArcGIS SDK.

Hi Thomas,

Based on what i have searched, there is a setOpacity() method for map view.

Kai Cong

Hi Kaicong,

Thanks for your response,

Here is what I am currently doing :

    ArcGISMap map = new ArcGISMap(Basemap.createTopographic());

    WmtsService wmtsService = new WmtsService(OneMapConstants.ONE_MAP_WMTS_SERVICE);
    wmtsService.addDoneLoadingListener(() -> {
        if (wmtsService.getLoadStatus() == LoadStatus.LOADED.LOADED) {
            WmtsServiceInfo wmtsServiceInfo = wmtsService.getServiceInfo();
            List<WmtsLayerInfo> layerInfos = wmtsServiceInfo.getLayerInfos();
            WmtsLayer wmtsLayer = new WmtsLayer(layerInfos.get(0));


            map.setBasemap(new Basemap(wmtsLayer));

   mapView.setAlpha((float) 0.75);
   mapView.getBackgroundGrid().setColor(ContextCompat.getColor(this, android.R.color.transparent));

And then I only display my location as usual.
I display the map on half of the screen to know if I am really on top of the other activity.

I can see the main activity in the background everywhere else on the screen but the Arcgis mapview is still completely black.

What should I change ?

To be honest, map layers are like photo-shop editing. My general opinion is to initialize the basemap once and “turn it off”(0 Opacity) when not required.

Doing this will

  1. Ensure your basemap is at the lowest of all displaying layers.
  2. You will not need to fetch additional map tiles (stored in memory)
  3. Smoother Map Transition