使用的默认配置,当图片链接采用的拼接方式生成的,列表视图中有些不能加载成功
Closed this issue · 2 comments
qdsfdhvh commented
I caught the following error on the request: code:503, Service Temporarily Unavailable
.
You need to customize httpClient and do the following configuration:
HttpClient(OkHttp) {
engine {
threadsCount = 3
}
}
and you may need to fix the size of the Image
in the ListItem
:
ListItem(leadingContent = {
Image(
painter = rememberImagePainter(url = it.iconUrl),
contentDescription = null,
modifier = Modifier.size(50.dp), // fix size
)
}, headlineContent = {
Text(text = it.time)
})
and configure the cache for the ImageLoader
:
ImageLoader {
interceptor {
memoryCacheConfig {
// Set the max size to 25% of the app's available memory.
maxSizePercent(applicationContext, 0.25)
}
diskCacheConfig {
directory(cacheDir.resolve("image_cache").toOkioPath())
maxSizeBytes(512L * 1024 * 1024) // 512MB
}
}
}
PostLiu commented
so good