一个适用于Android和Compose Multiplatform的图片加载库。Coil具有以下特点:
Coil是Coroutine Image Loader的缩写。
翻译:日本語、한국어、Русский、Svenska、Türkçe、中文
Coil可在mavenCentral()上获取。
implementation("io.coil-kt:coil:2.7.0")
导入Compose扩展库:
implementation("io.coil-kt:coil-compose:2.7.0")
使用AsyncImage可组合项加载图片:
AsyncImage( model = "https://example.com/image.jpg", contentDescription = null, )
使用load扩展函数将图片加载到ImageView中:
imageView.load("https://example.com/image.jpg")
可以通过可选的尾随lambda配置请求:
imageView.load("https://example.com/image.jpg") { crossfade(true) placeholder(R.drawable.image) }
查看Coil的完整文档了解更多信息。
Copyright 2024 Coil Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.