Glide获取Bitmap和Drawable

        val options = RequestOptions()
        options.diskCacheStrategy(DiskCacheStrategy.ALL)
        options.centerCrop()
        Glide.with(this).asBitmap().load("http://i1.ciimg.com/598337/ec9c54bc2d231e6dt.jpg").apply(options).into(target)
  val target = object : SimpleTarget(){
        override fun onResourceReady(resource: Bitmap?, transition: Transition<in Bitmap>?) {
            user_icon.setImageBitmap(resource!!)
            main_icon.setImageBitmap(resource!!)
        }

    }

    val target1 = object : SimpleTarget(){
        override fun onResourceReady(resource: Drawable?, transition: Transition<in Drawable>?) {
            user_icon.setImageDrawable(resource!!)
            main_icon.setImageDrawable(resource!!)
        }

你可能感兴趣的:(Android)