1

从 Web URL 加载图像并在加载过程中显示微光。有没有更好的方法来处理这个问题?

val context = LocalContext.current
val imageLoader = ImageLoader(context)

val request = ImageRequest.Builder(context)
        .data(thumbnailUrl)
        .build()

val painter = rememberImagePainter(
        request = request,
        imageLoader = imageLoader
    )

val state = painter.state

Image(
  painter = painter,
  contentDescription = "thumbnail image",
  modifier = Modifier
            .fillMaxSize()
            .placeholder(
                visible = state is 
  ImagePainter.State.Loading,
                color = PlaceholderDefaults.color(
                    backgroundColor = MyTheme.colors.shimmer.copy(0.1f),
                ),
                highlight = PlaceholderHighlight.shimmer(),
            ),
        contentScale = ContentScale.Crop
    )

您将如何向此请求添加令牌?我尝试使用令牌设置标头但没有响应。有什么建议么?

4

0 回答 0