SHARE
TWEET

Untitled

a guest Jun 20th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top