Ashish Bhatia
Ashish Bhatia

Reputation: 51

Android listview should have same imageview size

I want to know whats the best approach for imageview size in listview. If I want to keep the imageview same irrespective of aspect ratio/image pixel,size. Somewhat like whatsapp does.

What is the best possible solution?

options

  1. Set parameters in layout xml file.
  2. Programatically.
  3. Make custom image with fixed size and use that in layout

Upvotes: 0

Views: 549

Answers (1)

Rod_Algonquin
Rod_Algonquin

Reputation: 26198

I would recommend using the layout(Option 1) that it can scale your photo without any calculation to the screen, through setting the the adjustViewBounds to true so you can still preserve its aspect ration.

as the documentation for it:

Set this to true if you want the ImageView to adjust its bounds to preserve the aspect ratio of its drawable.

Upvotes: 1

Related Questions