철스토리
Glide - 이미지뷰 관련 라이브러리 본문
반응형

출처 : https://github.com/bumptech/glide
이미지뷰에 이미지를 보여줄 때 사용하는 라이브러리중에 내가 가장 많이 쓰는 라이브러리이다.
- Google에서 개발해서 밀고있던 volly이후에 2014년에 공개된 라이브러리
- 다른 이미지 로딩라이브러리에는 없는 썸네일보기, GIF로딩, 동영상 스틸 보기 기능까지 지원합니다.
* Gradle
repositories { mavenCentral() // jcenter() works as well because it pulls from Maven Central } dependencies { compile 'com.github.bumptech.glide:glide:3.7.0' compile 'com.android.support:support-v4:19.1.0' }
* ProGuard
-keep public class * implements com.bumptech.glide.module.GlideModule -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** { **[] $VALUES; public *; } -keepresourcexmlelements manifest/application/meta-data@value=GlideModule
* 실제 사용방법
Glide .with(this) .load(url) .centerCrop() .placeholder(R.drawable.loading_spinner) .crossFade() .into(myImageView);
이런식으로 사용한다. 진짜 편함....
* 유용한 함수
- override(200, 100) - 지정한 이미지 사이즈만큼 불러오기 (가로, 세로)
- placeholder(R.drawable.loding) - 이미지를 로딩할 때 보여주는 이미지를 등록
- error(R.drawable.error) - 이미지가 에러가 났을 때 보여주는 이미지를 등록
- thumbnail(0.1f) - 지정한 %비율만큼 미리 가져와서 보여줌 0.1f 이면 10%임
- asGif(R.drawable.gif_image) - Gif 이미지도 되는게 진짜 좋음...
- diskCacheStrategy(DiskCacheStrategy.NONE) - 캐시를 할지 말지 결정함
반응형
'안드로이드 > 유용한 라이브러리' 카테고리의 다른 글
| StickyScrollView - Scrollview 중 일부 타이틀 고정 (0) | 2016.10.05 |
|---|---|
| TedPermission - 안드로이드 6.0 마시멜로우 권한설정 라이브러리 (0) | 2016.10.01 |
| SugarORM - 안드로이드 DB접근을 쉽게 (0) | 2016.09.30 |
| Retrofit2 - 서버와 데이터를 주고받는 라이브러리 (작성중) (0) | 2016.09.17 |
| ScalableLayout - 비율에 맞춰서 화면 조절 (1) | 2016.07.11 |
Comments