ㄷㅣㅆㅣ's Amusement
[Android/Java] Glide, An Image Loader. -- 1. Overview 본문
[Android/Java] Glide, An Image Loader. -- 1. Overview
반응형
Glide
you will save yourself a lot of time & headache.
- Why use glide?
- Android is not good when working with images, since it will load images into the memory pixel by pixel.
- Google introduce this library(Glide) in Google I/O 2015.
- Even Google official application uses Glide.
- example
- 1234567891011@Overridepublic View getView(int position, View convertView, ViewGroup parent) {if (null == convertView) {convertView = inflater.inflate(R.layout.imageView, parent, false);}Glide.with(context).load(images[position]).into((ImageView) convertView);return convertView;}
- Save yourself a lot of time & headache.
- Automatically resource re-use.
- Glide automatically takes care of the request canceling, clearing of the ImageViews.
- Glide load the correct image into the appropriate ImageView.
- So, You don’t need to make any code to image control for scrolling in “getView()”
- Cache policy
- Glide uses three sources: memory, disk and network. but, there is nothing coder will have to do.
- Glide hides all that complexity from coder, while creating intelligently sized caches for coder.
- Memory-wise
- In comparison to Picasso, Glide is much more efficient memory-wise.
- Glide automatically limits the size of the image it holds in cache and memory to the ImageView dimensions.
- Picasso also has the same ability, but requires a call to fit().
- Additional Function
- Placeholder
- Error-Placeholder
- Crossfade animation. (default 300ms)
- 1234567Glide.with(context).load("http://www.childc.co.kr/some_image.png").placeholder(R.mipmap.ic_launcher) // can also be a drawable.error(R.mipmap.future_studio_launcher) // will be displayed if the image cannot be loaded.crossfade().into(imageViewError);
cs
- Displaying Gifs (Nothing is different from image)
- Displaying Thumbnail of video
반응형
'Programming > Android' 카테고리의 다른 글
[Android/Java] 병렬 프로그래밍 : Executor Framework에대한 고찰 ----- 2 (2) | 2016.12.05 |
---|---|
[Android/Java] 병렬 프로그래밍 : Executor Framework에대한 고찰 ----- 1 (0) | 2016.12.01 |
[Android/JAVA] MMS 보내는 코드 (20) | 2015.11.19 |
[Android/JAVA] WebView가 깜박일 때. (0) | 2015.11.19 |
Android Soft Keyboard (0) | 2015.11.07 |
Comments