【发布时间】:2019-05-23 17:42:24
【问题描述】:
我正在加载 Google Map GroundOverlay 和 Glide 像这样
Glide.with(this)
.asBitmap()
.load("url")
.into(updateOverlayTarget2)
目标是
private val updateOverlayTarget = object : SimpleTarget<Bitmap>() {
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
val bounds = LatLngBounds(LatLng(34.5362, -96.9535), LatLng(39.9342, -89.8475))
val overlay = GroundOverlayOptions()
.image(BitmapDescriptorFactory.fromBitmap(resource))
.positionFromBounds(bounds)
googleMap1?.addGroundOverlay(overlay)
}
}
这对我很有用。但是,当我下载远程图像时,将其放在drawable 文件夹中,而不是使用BitmapDescriptorFactory.fromBitmap(resource),我使用BitmapDescriptorFactory.fromResource(resourceId),我立即收到OutOf Memory 错误。我的图像中有 alpha 通道。
我在这里有点困惑。 Glide 不能在这里使用默认的 RGB_565,因为这种格式没有 alpha。它是否在进行其他压缩?
【问题讨论】:
标签: android android-glide android-image