Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. imageView.viewTreeObserver.addOnGlobalLayoutListener {
  2. Glide.with(this)
  3. .load(TargetActivity.IMAGE_URL)
  4. .into(object : CustomTarget<Drawable>(imageView.width, 1) {
  5. // imageView width is 1080, height is set to wrap_content
  6. override fun onLoadCleared(placeholder: Drawable?) {
  7. // clear resources
  8. }
  9.  
  10. override fun onResourceReady(resource: Drawable, transition: Transition<in Drawable>?) {
  11. // bitmap will have size 1080 x 805 (original: 1571 x 1171)
  12. imageView.setImageDrawable(resource)
  13. }
  14. })
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement