简体   繁体   English

Android滑行加载位图

[英]Android glide load bitmap

In my app, i have an image view, the image content I get from the server is in the format of base64 encoded string. 在我的应用程序中,我有一个图像视图,我从服务器获取的图像内容为base64编码字符串的格式。 I store it locally and decode it to bitmap. 我将其存储在本地并将其解码为位图。 This bitmap is loaded to the image view. 该位图将加载到图像视图。 This makes the app to scroll slow. 这会使应用滚动速度变慢。 Now I found the reason behind that is no caching is done for the bitmap. 现在,我发现背后的原因是未对位图进行缓存。 One recommended a solution to use glide. 一个建议使用滑行的解决方案。 But I did not find any method to load bitmap using glide. 但是我没有找到任何使用glide加载位图的方法。 I just found the following method 我刚发现以下方法

Glide.with(context).load("http://goo.gl/gEgYUd").into(pollWebView);

can we load bitmap using glide? 我们可以使用滑行加载位图吗?

您可以将File传递给Glide。

Glide.with(context).load(new File("your/file/name.jpg")).into(pollWebView);

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

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