gpt4 book ai didi

android - 在 web View 中将可绘制资源作为图像访问

转载 作者:太空宇宙 更新时间:2023-11-03 12:24:21 25 4
gpt4 key购买 nike

我的包中有一个 png 文件,我只想将它用作我在 web View 中通过 html 加载的图像的源。

到目前为止我已经尝试过了,this , thisthis .这些都没有真正起作用。

这是我将 img 标签添加到 html 的方法。谁能帮我?我正在尝试为尽可能早的 SDK 版本构建它(目前为 4 [1.6])

String stringPath = "fie:///android_asset/chat_bubble.png";
addOn = String.format("<img src=\"%s\" >", stringPath);

最佳答案

(我假设您从项目中复制了代码 fragment 。)

有一个错字:

String stringPath = "fie:///android_asset/chat_bubble.png";

应该是

String stringPath = "file:///android_asset/chat_bubble.png";

而且你没有关闭<img>标签:

addOn = String.format("<img src=\"%s\" >", stringPath);

应该是

addOn = String.format("<img src=\"%s\" />", stringPath);

关于android - 在 web View 中将可绘制资源作为图像访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6297435/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com