簡體   English   中英

圖像未覆蓋應用程序背景的全寬

[英]image is not covering full width of the background of app

我在我的應用程序中使用 picasso 庫使用大小為 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);
}

我在調整大小方法中嘗試了不同的寬度和高度,但無法覆蓋所有視圖。

我認為您需要指定ScaleTypeImageview

嘗試使用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!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM