Reputation: 746
I've come across this simple problem with the Picasso library
. I haven't find any way to put an image into ImageView
center it like android:ScaleType="center"
does without cropping. Do you have any ideas about how to solve this ? My problem is that I don't know at the runtime the height and width of the BitMap
I download so I can't use resize()
properly.
Upvotes: 3
Views: 4418
Reputation: 148
i am not found fit to center without resizing,
Picasso.get()
.load(source).resize(1650,700)
.centerCrop(Gravity.CENTER).into(imageView, new Callback()
Upvotes: 0
Reputation: 628
This is a little late, but for anyone who's looking for a solution :
Picasso
.with(context)
.load(ImageURL)
.fit()
// call .centerInside() or .centerCrop() to avoid a stretched image
.into(imageViewFit);
Upvotes: 2
Reputation: 30985
If your ImageView
is fixed one dimension and flexible another dimension (ex. android:width="match_parent"
, android:height="wrap_content"
), you should be able to use android:adjustViewBounds="true"
to get the ImageView
to resize to display your image without cropping.
Upvotes: 1