1

Wasn't sure how to correctly title this but essentially my images fill their ImageViews differently between different versions of Android.

Example:

Imageviews

From the left it's 4.1.1, 4.4.4, and 5.0.0. All on the same device (Nexus 4).

KitKat and Lollipop are as expected but Jellybean fails to follow suit regardless of what I do and regardless of screen density.

I'm using Picasso for loading the images and a RecyclerView/CardView combo for the lists.

There's nothing really special about the code and it's rather standard in terms of Picasso, but here's the XML for the ImageView if anyone wants it:

        <ImageView
            android:id="@+id/news_image"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:contentDescription="@string/news_image_content_description"
            android:scaleType="fitCenter"
            android:cropToPadding="false"
            android:adjustViewBounds="true"/>
David Liaw
  • 3,193
  • 2
  • 18
  • 28
  • On a whim I checked the Dev Docs and found this under `adjustViewBounds`: "*If the application targets API level 17 or lower, adjustViewBounds will allow the drawable to shrink the view bounds, but not grow to fill available measured space in all cases.*" I think I figured out the problem, but still trying to find a solution. – David Liaw Jan 26 '15 at 17:29

1 Answers1

1

Finally figured it out. As I mentioned in that comment, pre-API 17 it won't let the drawable grow to fill the ImageView, only shrink. So my solution was to use Picasso to upscale the Image and let the system resize it down, as per observations from this SO post

Community
  • 1
  • 1
David Liaw
  • 3,193
  • 2
  • 18
  • 28