I have a listView with an adapter that contains ImageView
of variable size (width and height). I need resize the pictures load with Picasso to the max width of layout and a variable height given by the aspect ratio of the picture.
I have checked this question: Resize image to full width and fixed height with Picasso
The fit()
works but I haven't found nothing to keep the aspect ratio of the picture.
This code partially works if I fixed the height in the layout of the adapter:
Picasso.with(this.context).load(message_pic_url)
.placeholder(R.drawable.profile_wall_picture)
.fit().centerInside()
.into(holder.message_picture);
But it generates blank spaces between the pictures of the listView because the pictures may be that not have that height.