How do I specify image dimentions in dp for an Android Gallery?

Posted by Richard on Stack Overflow See other posts from Stack Overflow or by Richard
Published on 2010-04-17T00:05:41Z Indexed on 2010/04/17 0:13 UTC
Read the original article Hit count: 525

Filed under:

All the examples I've see for using the Gallery view in Android set a specific pixel size for the images using:

i.setLayoutParams(new Gallery.LayoutParams(200, 200));

I want to have my gallery images sized based on the screen density (ldpi, mdpi, hdpi). Can someone give me an example of how to specify gallery image dimensions using dp?

Thanks!

© Stack Overflow or respective owner

Related posts about android