[英]How to store the image in webView?
As I am a newbie, I don't know how to google to solve this question. 由于我是新手,所以我不知道如何使用Google解决这个问题。
Then I ask this question. 然后我问这个问题。
Now, I have a list in an Html
show in the WebView in the App. 现在,我在应用程序的WebView的
Html
节目中有一个列表。 like this: 像这样:
You can see an image located in the left area in an item of the list. 您可以在列表项的左侧看到图像。
Is there a way to store the list image. 有没有一种方法来存储列表图像。
How to store the image Use the javascript
? 如何使用
javascript
存储图像?
or 要么
How to store the image by using the iOS webView API? 如何使用iOS webView API存储图像?
How to store the image by using the Android webView API? 如何使用Android webView API存储图像?
What I need: 我需要的:
In a week or several days, the app requests the same network image once. 在一周或几天内,该应用程序一次请求相同的网络映像。 Now, my app requests the image every time.
现在,我的应用每次都请求图像。 This way waste user's mobile phone traffic.
这样浪费了用户的手机流量。
If you don't know my expression. 如果你不知道我的表情。 I know a perfect library named
SDWebImage
. 我知道一个名为
SDWebImage
的完美库。 In iOS APP, the SDWebImage
can store the image in a week. 在iOS APP中,
SDWebImage
可以在一周内存储图像。
If you are loading it using WebView
, you should consider caching the WebPage. 如果使用
WebView
加载它,则应考虑缓存WebPage。 You can enable the cache for WebView
using this property: 您可以使用以下属性为
WebView
启用缓存:
https://developer.android.com/reference/android/webkit/WebSettings.html#LOAD_CACHE_ELSE_NETWORK https://developer.android.com/reference/android/webkit/WebSettings.html#LOAD_CACHE_ELSE_NETWORK
mWebView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
Else if you are using URL's to load the image into custom ListView or RecyclerView, this library could help you out: 否则,如果您使用URL将图像加载到自定义ListView或RecyclerView中,则该库可以为您提供帮助:
https://github.com/nostra13/Android-Universal-Image-Loader https://github.com/nostra13/Android-Universal-Image-Loader
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.