Reputation: 8304
Thanks to this site, I successfully implemented a Horizontal ListView of ImageViews. Now what I need is for the ImageViews in the list to have a fixed height (they're part of a more complex layout, so I'm using the LinearLayout weight trick to give it a height equal to 1/3 of the screen height), and a width that adjusts in relation to the height without destroying aspect ratio. The images have a longer height than width - an aspect ratio similar to a phone on portrait.
Now I've tried setting the scaleType to the different available settings, also set adjustViewBounds to true, and set the layout_width to wrap_content and layout_height to fill_parent. The nearest I got to doing it was this:
http://img849.imageshack.us/img849/1289/device20120831133004.png (i placed the white borders as image background)
What else can be done?
Upvotes: 0
Views: 1498
Reputation: 23952
Problem here is that your ImageView
cannot be adjusted to desired height because it's aspect ratio is different from screen. Your view matching screen height (or 1/3 of it) and width cannot be scaled proportionally without crop.
Try to set scaleType
to centerCrop
and load images resized to desired height.
Upvotes: 0