[英]What is a good way to load images in Android WebView?
Premise 前提
onProgressChanged()
newProgress == 100
,then show it for user, it will wait lots of time, and when network is not good, this experience was to terrible onProgressChanged()
newProgress == 100
时等待它,然后向用户显示它,它将等待很多时间,并且当网络不好时,这种体验太糟糕了 Two way i know 我知道的两种方式
What is a good way to load images in Android WebView ? 在Android WebView中加载图像的好方法是什么?
Please Thanks ! 请谢谢!
One of the most famous way to load images from any source into the app is by using an image loading library called Glide . 从任何来源将图像加载到应用程序中,最著名的方法之一是使用名为Glide的图像加载库。
Follow the setup steps to get started. 请按照设置步骤开始。 In the activity that you want an image to be loaded, declare an ImageView variable and use
在要加载图像的活动中,声明一个ImageView变量并使用
ImageView imej = (ImageView) findViewById (R.id.imageID);
Glide.with(this).load("URL").into(imej);
If you wish to use the cache capabilities, add 如果您希望使用缓存功能,请添加
.diskCacheStrategy(DiskCacheStrategy.SOURCE*)
between the .load() and .into() methods. 在.load()和.into()方法之间。 Note that DiskCacheStrategy has 4 types.
请注意,DiskCacheStrategy具有4种类型。 Choose wisely.
做出明智的选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.