如何使用Glide从ImageView获取位图

时间:2019-12-01 04:54:38

标签: android

如何将Viewpager图像转换为位图

val img = adapter.currentItem //return an int data type.

1 个答案:

答案 0 :(得分:0)

您也可以使用Glide获取imageview的位图,示例为

Glide.with(this)
    .asBitmap()
    .load(yourURL)
    .into(object : CustomTarget<Bitmap>(){
        override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
            // you can use the bitmap here
        }
        override fun onLoadCleared(placeholder: Drawable?) {

        }
    })
相关问题