How to fit Image into ImageView using Glide

后端 未结 6 577
走了就别回头了
走了就别回头了 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:56

    If use Glide v4 GlideApp instance of Glide:

    GlideApp.with(view.getContext())
            .load(url)
            .centerCrop()
            .into(view);
    

    If use databinding:

    @BindingAdapter("glideCropCenter")
    public static void setProgress(ImageView view, string url) {
        GlideApp.with(view.getContext())
                .load(url)
                .centerCrop()
                .into(view);
    }
    

    In xml:

           
    

提交回复
热议问题