MapBox: Capture whole screen but mapboxmap turned out to be black

心已入冬 提交于 2021-01-29 20:18:03

问题


I am implementing a running tracker. My UI consists of a MapBox mapView and a display that contains a few layouts that make up the time, distance etc. The mapView takes up the top half of the parent layout while the display takes up the bottom half. After the run I want to take a screenshot of the screen and save the img as a Bitmap. However when I use the conventional way of getDrawingCache(), the part of the img that is the mapView becomes a black box. Anyone knows how to solve this problem?

I have also tried the Canvas way but it did not work.

Below is the code to get the BitMap

view.setDrawingCacheEnabled(true);
view.buildDrawingCache(true);
Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache());
view.setDrawingCacheEnabled(false);

来源:https://stackoverflow.com/questions/62431836/mapbox-capture-whole-screen-but-mapboxmap-turned-out-to-be-black

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!