简体   繁体   English

Android Mapbox Mapview 在渲染地图之前显示白屏

[英]Android Mapbox Mapview shows white screen before rendering maps

Mapbox Mapview shows a white screen flash before the Mapview is rendered. Mapbox Mapview 在渲染 Mapview 之前显示白屏闪烁。 The flash stays for like 500ms after which the map is displayed.闪光灯停留大约 500 毫秒,然后显示地图。 I am adding Mapview dynamically to my FrameLayout((addView()) at run time. Below is the code snippet. Please help !我在运行时动态地将 Mapview 添加到我的 FrameLayout((addView())。下面是代码片段。请帮忙!

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 at this point
           }

    }
}

Screenshot Link : screenshot link截图链接:截图链接

Had to change the color to another with: mapboxMapOptions.foregroundLoadColor(int color)不得不将颜色更改为另一种: 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.我们尝试屏蔽 glsurfaceview 已加载但我们没有任何内容要呈现,因为我们仍在加载样式定义。 instead of loading resources, having them offline will also improve the UX.而不是加载资源,让它们离线也将改善用户体验。

Credits to tobrun for the info https://github.com/mapbox/mapbox-gl-native/issues/16367归功于 tobrun 的信息https://github.com/mapbox/mapbox-gl-native/issues/16367

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM