简体   繁体   English

如何在Android的WebView中的ImageView上设置图像

[英]How to set image on a imageview in webview in android

Trying to change the profile image on the web view. 尝试在网络视图上更改个人资料图像。 But when trying the updated image showing a crashed image. 但是当尝试更新的图像时显示崩溃的图像。

webView.loadUrl("javascript: (function() {document.getElementById('SelectedImage').src='"+profilePath+"';}) ();");

If profilePath is a Uri object, then you need to get the absolute path from the object. 如果profilePath是Uri对象,则需要从该对象获取绝对路径。
Use File f = new File(profilePath.toString()); 使用File f = new File(profilePath.toString());

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM