图像未覆盖应用程序背景的整个宽度



我正在使用毕加索图书馆在我的应用程序中使用大小为 1080*1920 的图像,但我的图像没有水平覆盖整个视图。这是毕加索的代码

private void initBackgroundImage() {
    ImageView background = (ImageView) findViewById(R.id.iv_background);
    Picasso.with(this).load(R.drawable.background).resize(70,120).centerCrop().into(background);
}

我在调整大小方法中尝试了不同的宽度和高度,但无法覆盖所有视图。

我认为您需要指定ImageviewScaleType

尝试使用fit()

Picasso.with(this).load(R.drawable.background)
        .fit().resize(70,120).centerCrop().into(background);

.centerCrop()

 Picasso.with(this).load(R.drawable.background)
        .centerCrop().resize(70,120).centerCrop().into(background);
Try using     Picasso.with(this).load(R.drawable.background).resize(70,120).fit().into(background);
or
Picasso.with(this).load(R.drawable.background).resize(70,120).into(background);
Don't use centerCrop() property if you are trying to show full image without cropping. Try using different image styles like centerInside() or fit()
Hope it may works!

最新更新