[Android Studio]이미지 라이브러리(Glide, Picasso) 사용방법 - URL에서 이미지 가져오기
| Computer/Android 2018. 7. 30. 00:161. Picasso를 사용한 방법
Picasso.get().load(UserItem.getIntance().getAccount().getPhotoUrl().toString()).into(mImageView);
* GoogleAPI를 사용해서 google의 프로필 사진 가져오는 방법. getPhotoUrl()에서 toString()을 하게되면 온전한 주소를 가져올 수 있다. (위의 예제는 UserItem을 싱글턴으로 만들어서 사용한 것임.)
2. Glide를 사용하는 방법
Glide.with(MainActivity.this).load("http://xxx.yyy/zzz.jpg").into(mImageView);
* 이렇게 하면 비동기적으로 이미지를 처리한다고 한다.
다음은 gradle에서 라이브러리 가져오는 방법.
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.bumptech.glide:glide:3.7.0'
이런 라이브러리가 없으면 개고생을 해야한다... 그냥 쓰자.
'Computer > Android' 카테고리의 다른 글
[Android Studio] Project, 패키지명, 앱 이름 바꾸기 (0) | 2018.07.30 |
---|---|
[Android Studio]EditText 한 줄 제한하기 (0) | 2018.07.30 |
[Android Studio]서버와 연결을 하기 위한 기본 구성 - retorifit2, Gson, okttp3 준비하기 (0) | 2018.07.30 |
[Android Studio]png파일이 검은색(black)으로 보이는 문제 (0) | 2018.07.30 |
[Android Studio]나라 명칭 string-array (0) | 2018.07.30 |