This article covers the following topics:
- Objective
- Glide's Introduction
- Configuration of the Glide
- Use of Glide
- Conclusion
The people who used to know, load the picture which strong, only glide, because glide adopt chain call, so load the picture as long as a sentence, and the default also has fade effect animation
Official quote.
- Glide is a fast and efficient open source media management and image loading Android framework for packaging media decoding, memory and disk caching, and resource pooling into a simple and easy to use interface
The advantages are
Easy to use
High degree of adaptability and high degree of adaptation
Supports common image formats, JPG, PNG, GIF, WEBP
Support multiple data sources, network, resources, assets, File, URI, etc.
Efficient cache policy supports memory and hard disk caching
Lifecycle integration automates management of requests based on the Activity/fragment life cycle
Efficient handling of bitmap
Github
- Https://github.com/bumptech/glide
Glide load the network picture
Configuration is simple, just add dependencies on the gradle of the project
Of course, if it involves loading pictures on the network, remember to increase network permissions
Glide support for activity and fragment bindings
The benefit of activity/fragment as a with () parameter is that picture loading is consistent with the life cycle of the Activity/fragment
Glide supports network resources, assets resources, resources, file resources, URI resources, byte arrays
① loading a static GIF picture
② loading animated GIF pictures
① setting load in picture
② Setting load failed picture
① fade in and fade out effect
② No animations
③ Custom Animations
① Setting skips memory cache
② Setting the cache policy
- Diskcachestrategy.all: Cache source resources and converted Resources
- Diskcachestrategy.none: Do not make any disk caches
- Diskcachestrategy.source: Cache Source Resource
- Diskcachestrategy.result: Caching the converted Resource
③ Cleanup Cache
You may not know that glide has a library on GitHub that can handle picture effects, film recommendations such as cropping, fillets, Gaussian blur, and more
① introduction of dependent libraries
② realization of Gaussian Blur
Glide usage is really comfortable, if you are an old hand, you can try to encapsulate the glideutils, let it use to your project, it is good only in the project to play out
Android combat--glide use, load pictures as long as a sentence