java - 如何将网页上的图片加载到webview中?

标签 java android html json webview

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

但它也无法打开或加载。

这里我捕获了结果: enter image description here

需要什么代码才能使其工作,请帮忙,谢谢。

这是我的代码

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);

最佳答案

Picasso加载图像然后尝试这个

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

Webview加载图像然后试试这个我的 friend

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

关于java - 如何将网页上的图片加载到webview中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47090245/

相关文章:

java - 三星 Galaxy S8 全屏模式

java - Google map .getMap() 已弃用

javascript - 如何在同一网页上使用 JavaScript 和 HTML 在文本框中显示手动输入的字符串值?

java - 使用相同描述符 Maven 程序集插件自定义不同格式的文件夹名称

java - 由 : java. lang.RuntimeException : Android classes not found error. 引起 是什么原因导致的?

java - 在面向对象设计中保持数据和格式分离

javascript - 我怎样才能在一个容器中有两个 div,以便在调整一个的大小时另一个自动调整大小以填充容器?

java - JTable.setDefaultEditor() 不起作用,但设置为特定字段有效。

android - 如何一次性否定 View 的颜色?

javascript - 如何向传单 map 添加叠加层?