Android combat--glide use, load pictures as long as a sentence

Source: Internet
Author: User

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

    1. Easy to use

    2. High degree of adaptability and high degree of adaptation

    3. Supports common image formats, JPG, PNG, GIF, WEBP

    4. Support multiple data sources, network, resources, assets, File, URI, etc.

    5. Efficient cache policy supports memory and hard disk caching

    6. Lifecycle integration automates management of requests based on the Activity/fragment life cycle

    7. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.