没有显示它的Mapbox地图的屏幕截图

时间:2018-04-04 10:20:41

标签: kotlin screenshot mapbox-android

我需要在同一个屏幕上显示地图上的一些地址预览。为此,我将使用位图显示Title: Perspective: Sustaining the big-data ecosystem. Title: Making proteomics data accessible and reusable: current state of proteomics databases and repositories. Title: ProteomeXchange provides globally coordinated proteomics data submission and dissemination. Title: Toward effective software solutions for big biology. Title: The NIH Big Data to Knowledge (BD2K) initiative. Title: Database resources of the National Center for Biotechnology Information. Title: Europe PMC: a full-text literature database for the life sciences and platform for innovation. Title: Bio-ontologies-fast and furious. Title: BioPortal: ontologies and integrated data resources at the click of a mouse. Title: PubMed related articles: a probabilistic topic-based model for content similarity. Title: High-Impact Articles-Citations, Downloads, and Altmetric Score. ,而不是制作ImageViews的多个实例。但为此,我需要找到一种方法来捕获这些位图。

我在MapboxMap(https://github.com/mapbox/mapbox-gl-native/issues/6062)中找到了MapView函数,但它需要显示地图。

snapshot

那么,我可以拍摄地图的快照而不在屏幕上显示它吗?

1 个答案:

答案 0 :(得分:0)

我终于找到了解决方案!我需要使用的课程是MapSnapshotter

val width = imageView.width
val height = imageView.height
val location = CameraPosition.Builder()
        .target(LatLng(55.7558, 37.6173))
        .zoom(16.0)
        .build()
val options = MapSnapshotter.Options(width, height)
        .withCameraPosition(location)
MapSnapshotter(context, options).start { snapshot ->
    imageView.setImageBitmap(snapshot.bitmap)
}