Image not loading through android webview

 ̄綄美尐妖づ 提交于 2019-12-23 20:13:06

问题


I have a webview that loads a webpage and sometimes in this webpage there are pictures. However, i have encountered 2 instances where the image does not load and they each give different outcome.

Outcome #1 : Webpage is loaded but image is not loaded (Format used : .jpeg)

Outcome #2 : Webpage is loaded but image is not loaded. However, at where the image should be, there is a icon with a question mark. (Format used : .jpg)

I have other webpages that have images of the same format and from the same directory too and works fine. All the images are taken from the same place which is at another website's server.

I have read on various websites to use loadDataWithBaseURL() and they give me the same results.

I am now at a loss at what to do. Do i need to save the image with a certain format and with certain settings ? Or is there something else that i need to do.

UPDATE : I believe the image's format and size does not matter as i have tried to visit the webpages using Dolphin and the default web browser but the results are the same. However, if i used Opera Web Browser, it is able to display the images.


回答1:


We found out that our JPG images were of 32 Bit depth. Once we re-export it to 24 Bit depth using GIMP, the images were able to show.

Also, if the images were in PNG, it should work even though it is 32 Bit depth.

Hope this helps other people out there.



来源:https://stackoverflow.com/questions/13487734/image-not-loading-through-android-webview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!