我正在尝试将线圈准备ImageRequest
为:
val drawable = when {
mimeType.startsWith("image") -> R.drawable.ic_baseline_image_24
mimeType.startsWith("video") -> R.drawable.ic_baseline_ondemand_video_24
mimeType.startsWith("audio") -> R.drawable.ic_baseline_audiotrack_24
else -> R.drawable.ic_baseline_attach_file_24
}
val imageRequest = ImageRequest.Builder(context)
.data(drawable)
.crossfade(true)
.target(imageView)
.build()
//blah-blah
// and somewhere deep inside code
imageLoader.enqueue(imageRequest)
但它不起作用。
我想应该有另一种方法,或者不ImageRequest
支持本地drawable?