在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):coil-kt/coil开源软件地址(OpenSource Url):https://github.com/coil-kt/coil开源编程语言(OpenSource Language):Kotlin 99.8%开源软件介绍(OpenSource Introduction):An image loading library for Android backed by Kotlin Coroutines. Coil is:
Coil is an acronym for: Coroutine Image Loader. Made with DownloadCoil is available on implementation("io.coil-kt:coil:2.1.0") Quick StartImageViewsTo load an image into an // URL
imageView.load("https://www.example.com/image.jpg")
// File
imageView.load(File("/path/to/image.jpg"))
// And more... Requests can be configured with an optional trailing lambda: imageView.load("https://www.example.com/image.jpg") {
crossfade(true)
placeholder(R.drawable.image)
transformations(CircleCropTransformation())
} Jetpack ComposeImport the Jetpack Compose extension library: implementation("io.coil-kt:coil-compose:2.1.0") To load an image, use the AsyncImage(
model = "https://example.com/image.jpg",
contentDescription = null
) Image LoadersBoth val imageLoader = context.imageLoader
val imageLoader = ImageLoader(context) If you do not want the singleton RequestsTo load an image into a custom target, val request = ImageRequest.Builder(context)
.data("https://www.example.com/image.jpg")
.target { drawable ->
// Handle the result.
}
.build()
val disposable = imageLoader.enqueue(request) To load an image imperatively, val request = ImageRequest.Builder(context)
.data("https://www.example.com/image.jpg")
.build()
val drawable = imageLoader.execute(request).drawable Check out Coil's full documentation here. Requirements
R8 / ProguardCoil is fully compatible with R8 out of the box and doesn't require adding any extra rules. If you use Proguard, you may need to add rules for Coroutines, OkHttp and Okio. License
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论