【问题标题】:How to load picture from web into webview?如何将网页上的图片加载到 webview 中?
【发布时间】:2018-04-15 20:37:37
【问题描述】:

我想从 web 或 url 地址加载图片,例如:` "https://images.detik.com/community/media/visual/2017/11/03/5e88c080-0570-47ca-8ea9-96209df2071d_169.jpeg?w=620"

但它也无法打开或加载。

我在这里捕获结果:

什么代码让它工作,请帮忙谢谢。

这是我的代码

WebView wv = (WebView) findViewById(R.id.webView1);
wv.getSettings().setBuiltInZoomControls(true);
wv.getSettings().setJavaScriptEnabled(true);
img= (ImageView) findViewById(R.id.mainbackdrop);

//BIND
nameTxt.setText(name);
propTxt.setText(propellant);
wv.loadData(desc, "text/html","UTF-8");
PicassoClient.downloadImage(this,imageurl,img);

【问题讨论】:

  • 显示你的代码。
  • @RatilalChopda 我认为此评论与帖子无关
  • 再次@RatilalChopda,我认为此评论与帖子无关
  • 我已经更新了我的问题..
  • 你到底想要什么?你搞乱了一个 webview 和一个 imageview。为什么?相当混乱。正如你现在拥有的那样,jpg 与 webview 无关。您的图片表明html页面包含无法找到的图片。为什么要发布一个如此令人困惑的问题?

标签: java android html json webview


【解决方案1】:

Picasso加载图片然后试试这个

Picasso.with(activity)
            .load(path)
            .placeholder(R.drawable.thumbnail_placeholder)
            .resize(width,height)
            .into(imageView);

Webview加载图片然后试试这个我的朋友

wv.getSettings().setUseWideViewPort(true);
wv.getSettings().setDomStorageEnabled(true);

【讨论】:

  • @Nilu 你不懂 wv.getSettings().setDomStorageEnabled(true);那么你的堆栈溢出 8500+ 信誉不正确
  • 还是得不到我想要的
  • 你想在 imageview 或 webview 中加载图像
  • 我想从 url web 加载图片到 webview
  • 我用 html 格式从数据库中填充数据并显示到 webview 中
猜你喜欢
  • 1970-01-01
  • 2021-02-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-10
  • 2014-03-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多