I am using an image of size 1080*1920 in my app using picasso library but my image is not covering entire view horizontally. Here is the code for picasso
private void initBackgroundImage() {
ImageView background = (ImageView) findViewById(R.id.iv_background);
Picasso.with(this).load(R.drawable.background).resize(70,120).centerCrop().into(background);
}
I have tried different width and height in resize method but not able to cover all the view.
I think you need to specify the ScaleType
of your Imageview
Try using fit()
:
Picasso.with(this).load(R.drawable.background)
.fit().resize(70,120).centerCrop().into(background);
or .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!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.