Ji *_*bin 10 android kotlin android-jetpack-compose
我已经使用Glide和Coil通过 Jetpack Compose 通过 URL 加载图像。
然而,图像只有黑色。我怎样才能解决这个问题?
我的Compose版本Coil是最新版本。
值kakaoProfile.value!!.profileImageUrl!!: https: //k.kakaocdn.net/dn/IOMxT/btqYvUIVMAL/VZCdMjf01kxnkFFZFNDJ81/img_640x640.jpg
这是我的代码:
Column(
modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.End,
verticalArrangement = Arrangement.Center
{
if (kakaoProfile.value == null) {
Icon(
imageVector = Icons.Outlined.AccountCircle,
contentDescription = null,
modifier = Modifier.size(100.dp),
tint = colors.primary
)
} else {
Icon(
painter = rememberCoilPainter(kakaoProfile.value!!.profileImageUrl!!),
contentDescription = null,
modifier = Modifier.size(100.dp)
)
}
}
.
.
.
Button(
modifier = Modifier.padding(start = 8.dp),
shape = RoundedCornerShape(15.dp),
colors = ButtonDefaults.buttonColors(backgroundColor = Color(0xFF393939)),
onClick = {
if (kakaoProfile.value == null) {
UserApiClient.instance.loginWithKakaoTalk(context) { token, error ->
if (error != null) {
Log.e("TAG", "Login Fail", error)
} else if (token != null) {
UserApiClient.instance.me { user, _ ->
kakaoProfile.value = user?.kakaoAccount?.profile
}
}
}
} else {
UserApiClient.instance.logout {
kakaoProfile.value = null
}
}
}
) {
Text(
text = if (kakaoProfile.value == null) "login" else "logout",
fontSize = 18.sp,
color = Color.White
)
}
Run Code Online (Sandbox Code Playgroud)
结果屏幕:(橙色圆圈是Icon)
问题屏幕
Dan*_*ugh 41
去掉图标上的色调。
Icon(
painter = rememberImagePainter(imageURL),
contentDescription = null,
modifier = Modifier.size(42.dp),
tint = Color.Unspecified
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5305 次 |
| 最近记录: |