【问题标题】:Is it possible to use drawables (not images) in WebView? [duplicate]是否可以在 WebView 中使用可绘制对象(不是图像)? [复制]
【发布时间】:2012-05-15 12:34:05
【问题描述】:

可能重复:
@Android display /res/viewable in WebView

是否可以在 WebView 中(img 标签内)使用可绘制对象(形状、渐变等)?

附:我读过this answer。所以,我知道如何插入图像,但是其他可绘制对象呢?

编辑

例如:我需要在 WebView 中显示圆圈(不使用画布)。

【问题讨论】:

标签: android html webview


【解决方案1】:

您可以直接在 标签的 URL 中插入 Base64 编码的图像数据。 URL 格式为“data:mimetype;base64,data”。例如参见here

【讨论】:

  • 看起来它会工作)至少现在我可以将Drawable压缩成Bitmap,从Bitmap获取字节数组,然后将数组编码为Base64。
猜你喜欢
  • 2014-01-11
  • 2012-02-20
  • 2018-11-12
  • 2012-07-27
  • 1970-01-01
  • 2010-10-05
  • 2016-11-28
  • 1970-01-01
  • 2012-02-01
相关资源
最近更新 更多