How to fit Image into ImageView using Glide

后端 未结 6 564
走了就别回头了
走了就别回头了 2021-01-31 02:20

My concern is how to fit image using android:scaleType=\"fitXY\" into image using Glide.

My ImageView is

<         


        
6条回答
  •  伪装坚强ぢ
    2021-01-31 02:47

    You can use centerCrop() or fitCenter() methods:

    Glide.with(context)
         .load(url)
         .centerCrop()
         .placeholder(R.drawable.default_image)
         .into(img)
    

    or

    Glide.with(context)
         .load(url)
         .fitCenter()
         .placeholder(R.drawable.default_image)
         .into(img)
    

    You can also find more information at: https://futurestud.io/tutorials/glide-image-resizing-scaling

提交回复
热议问题