I'm currently working on a view which would display different images downloaded from online, the images could have a different ratio but would still have a higher width than height.
Unfortunately for the moment my ListView cell has a defined height even though I put wrap_content in the cell layout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
<ImageView
android:id="@+id/recipe_elem_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/logo"/>
</LinearLayout>
I'm using Picasso to download the image
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final View rowView = mInflater.inflate(R.layout.recipe_element_view, parent, false);
Recipe item = getItem(position);
Picasso.with(mContext).load(item.getPictureUrl())
.into((ImageView) rowView.findViewById(R.id.recipe_elem_img));
return rowView;
}
and here's the result:
I basically want to get rid of the yellow part for every image no matter their aspect ratio.