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

Android Mapbox Mapview shows white screen before rendering maps #16367

Closed
bssandeshbs opened this issue Apr 1, 2020 · 1 comment
Closed

Android Mapbox Mapview shows white screen before rendering maps #16367

bssandeshbs opened this issue Apr 1, 2020 · 1 comment

Comments

@bssandeshbs
Copy link

bssandeshbs commented Apr 1, 2020

Mapbox Mapview shows a white screen flash before the Mapview is rendered. The flash stays for like 500ms after which the map is displayed. I am adding Mapview dynamically to my FrameLayout((addView()) at run time. Below is the code snippet. Please help !

Is there any property that needs to be specifically set for mapview

Platform: Android
Mapbox SDK version: 9.0.0

Steps to trigger behavior

  1. Create a new Mapbox() Instance
  2. Add it to a layout dynamically
  3. Call Mapbox.getAsync() API
  4. white screen flash before mapview is displayed
private fun initializeMapBoxMap() {
    val mapView = MapView(context) // create new mapview 
    innerLayout.addView(mapView) // add mapView to the FrameLayout
    mapView.getMapAsync { mapboxMap ->
           // white screen shown at this point for 500 ms 
           mapboxMap.setStyle(Style.DARK) {
              // white screen gone after this point
           }
    }
}

Expected behavior : white screen should not be shown before rendering maps

Actual behavior : white screen shown before rendering the maps

Mapbox

@tobrun
Copy link
Member

tobrun commented Apr 2, 2020

you can change the color to another with:

mapboxMapOptions.foregroundLoadColor(int color)

we try to mask that the glsurfaceview has loaded but we don't have any content to render as we are still loading the style definition. instead of loading resources, having them offline will also improve the UX.

@tobrun tobrun closed this as completed Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants