glide README

The project's README from github.com/bumptech/glide. As one markdown file: README.md.

Glide

Maven Central | View Glide's documentation | 简体中文文档 | Report an issue with Glide

Glide is a fast and efficient open source media management and image loading framework for Android that wraps media decoding, memory and disk caching, and resource pooling into a simple and easy to use interface.

Glide supports fetching, decoding, and displaying video stills, images, and animated GIFs. Glide includes a flexible API that allows developers to plug in to almost any network stack. By default Glide uses a custom HttpUrlConnection based stack, but also includes utility libraries plug in to Google's Volley project or Square's OkHttp library instead.

Glide's primary focus is on making scrolling any kind of a list of images as smooth and fast as possible, but Glide is also effective for almost any case where you need to fetch, resize, and display a remote image.

Download

For detailed instructions and requirements, see Glide's download and setup docs page.

You can download a jar from GitHub's releases page.

Or use Gradle:

repositories {
  google()
  mavenCentral()
}

dependencies {
  implementation 'com.github.bumptech.glide:glide:5.0.9'
}

Or Maven:

<dependency>
  <groupId>com.github.bumptech.glide</groupId>
  <artifactId>glide</artifactId>
  <version>5.0.9</version>
</dependency>

For info on using the bleeding edge, see the Snapshots docs page.

R8 / Proguard

The specific rules are already bundled into the aar which can be interpreted by R8 automatically

How do I use Glide?

Check out the documentation for pages on a variety of topics, and see the javadocs.

For Glide v3, see the wiki.

Simple use cases will look something like this:

// For a simple view:
@Override public void onCreate(Bundle savedInstanceState) {
  ...
  ImageView imageView = (ImageView) findViewById(R.id.my_image_view);

  Glide.with(this).load("https://goo.gl/gEgYUd").into(imageView);
}

// For a simple image list:
@Override public View getView(int position, View recycled, ViewGroup container) {
  final ImageView myImageView;
  if (recycled == null) {
    myImageView = (ImageView) inflater.inflate(R.layout.my_image_view, container, false);
  } else {
    myImageView = (ImageView) recycled;
  }

  String url = myUrls.get(position);

  Glide
    .with(myFragment)
    .load(url)
    .centerCrop()
    .placeholder(R.drawable.loading_spinner)
    .into(myImageView);

  return myImageView;
}

Status

Version 4 is now released and stable. Updates are released periodically with new features and bug fixes.

Comments/bugs/questions/pull requests are always welcome! Please read CONTRIBUTING.md on how to report issues.

Compatibility

If you need to support older versions of Android, consider staying on Glide v3, which works on API 10, but is not actively maintained.

Build

Building Glide with gradle is fairly straight forward:

git clone https://github.com/bumptech/glide.git
cd glide
./gradlew jar

Note: Make sure your Android SDK has the Android Support Repository installed, and that your $ANDROID_HOME environment variable is pointing at the SDK or add a local.properties file in the root project with a sdk.dir=... line.

Samples

Follow the steps in the Build section to set up the project and then:

./gradlew :samples:flickr:run
./gradlew :samples:giphy:run
./gradlew :samples:svg:run
./gradlew :samples:contacturi:run

You may also find precompiled APKs on the releases page.

Development

Follow the steps in the Build section to setup the project and then edit the files however you wish. Android Studio cleanly imports both Glide's source and tests and is the recommended way to work with Glide.

To open the project in Android Studio:

  1. Go to File menu or the Welcome Screen
  2. Click on Open...
  3. Navigate to Glide's root directory.
  4. Select setting.gradle

For more details, see the Contributing docs page.

Getting Help

To report a specific problem or feature request, open a new issue on Github. For questions, suggestions, or anything else, email Glide's discussion group, or join our IRC channel: irc.freenode.net#glide-library.

Contributing

Before submitting pull requests, contributors must sign Google's individual contributor license agreement.

Thanks

Author

Sam Judd - @sjudd on GitHub, @samajudd on Twitter

License

BSD, part MIT and Apache 2.0. See the LICENSE file for details.

Disclaimer

This is not an official Google product.

glide (bumptech/glide)

Searching Database…

35K ·GitHub
这是做什么用的?一个快速高效的 Android 开源媒体管理和图片加载框架:它把媒体解码、内存和磁盘缓存以及资源池化封装在一个简单的接口后面。
它是框架还是库?README 称它为框架,但你可以像使用库一样用它:把它作为依赖加入项目,它就会通过一套简单的 API 帮你完成媒体的获取、解码、缓存和显示。
怎么把 Glide 加到我的 Android 项目里?用 Gradle 或 Maven 添加,或从 GitHub 发布页下载 jar 包;下载和配置文档页面有完整的说明。R8/ProGuard 规则已经内置在 aar 里了。
它支持哪些 Android 版本?Glide v4 要求最低 Android API 级别为 14,并且你的项目必须以 API 26 或更高版本编译。要支持更老的设备(最低到 API 10),就得停留在 v3,而 v3 已经不再积极维护了。
有什么已知的坑吗?CircleImageView 这类圆形图片控件会和 crossfade 过渡动画以及动图 GIF 冲突——请改用 BitmapTransformation(比如 circleCrop)或调用 .dontAnimate()。地图这类超大图片会通过降采样加载,但不支持缩放和平移视图。
Glide 也能用在 iOS 或网页上吗?不能——Glide 是专门为 Android 应用打造的图片加载框架,没有 iOS、桌面或网页版本。
它能加载哪些媒体——只有静态图片吗?不止——除了静态图片,Glide 还能通过同一套流程获取、解码并显示视频截帧和动图 GIF。
Glide 会把我绑定到某个特定的网络库上吗?不会。默认网络层基于 HttpUrlConnection,另外还有可选的集成库,可以换成 Google 的 Volley 或 Square 的 OkHttp。
为什么流畅滑动对 Glide 这么重要?这正是它的核心目标:让滚动浏览任何图片列表都尽可能流畅快速——缓存和资源池化都是为这个目标服务的。此外,凡是需要获取、调整尺寸并显示远程图片的场景,它也都很好用。
Glide v4 稳定吗?还在维护吗?是的——4.x 版本已经发布且稳定,会定期发布包含新功能和 bug 修复的更新。旧版 v3 的文档在 wiki 上。
Creator
bumptech
Size
96.2 MB
Stars
35K
Age
13y
Commits · 90 Days