如何在不使用外部库的情况下在 Jetpack Compose 中显示 Base64 编码的图像

nwa*_*agu 3 base64 android image-loading android-jetpack-compose

我可以将 base64 字符串转换为,android.graphics.Bitmap但从我在网上可以找到的所有内容来看,我仍然需要线圈或滑翔来显示它

Gab*_*tti 5

如果您有,Bitmap则可以使用.asImageBitmap()扩展来获取 ComposeImageBitmap对象。

然后在可组合项中使用它Image。

Image(
    bitmap = bitmap.asImageBitmap(),
    contentDescription = "contentDescription"
)
Run Code Online (Sandbox Code Playgroud)