How to fit Image into ImageView using Glide

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

    
    

    .....................................

    implementation 'com.github.bumptech.glide:glide:4.8.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
    
    AppCompatImageView ivPhoto = findViewById(R.id.ivPhoto);
    
    Glide.with(this)
                .load("https://www.gettyimages.ca/gi-resources/images/Homepage/Hero/UK/CMS_Creative_164657191_Kingfisher.jpg")
                .apply(new RequestOptions()
                        .placeholder(R.drawable.place_holder_gallery)
                        .error(R.drawable.ic_no_image)
                )
                .into(ivPhoto);
    

提交回复
热议问题