我正在使用 Jetpack Compose 实现一个简单的画廊屏幕,它在屏幕上显示所有视频和图像缩略图
我已成功显示来自文件路径的图像。但是,我在显示视频缩略图时遇到了麻烦。我怎么能用线圈做到这一点?
这是我显示图像缩略图的代码:
@Composable
fun ImageLoaderFromLocal(
url: String,
placeHolderResId: Int,
modifier: Modifier,
transformation: Transformation
) {
val painter = rememberImagePainter(data = File(url),
builder = {
placeholder(placeHolderResId)
crossfade(true)
transformations(transformation)
})
Image(
painter = painter,
contentDescription = null,
modifier = modifier,
contentScale = ContentScale.Inside
)
}