Android: How to prevent image from being scaled in ImageView or ImageButton?

Posted by user277827 on Stack Overflow See other posts from Stack Overflow or by user277827
Published on 2010-03-09T02:00:51Z Indexed on 2010/03/09 2:06 UTC
Read the original article Hit count: 500

Filed under:
|
|
|

Hi,

How can I prevent my bitmap from being scaled automatically in an ImageView or ImageButton if the view or button is stretched using "fill_parent" or using "weight"?

This will be useful, for example, to create a 4-button toolbar at the top of the screen where the buttons are equally spaced, but the images inside the buttons keep getting streched even if I use scaleType="center", which should prevent scaling according to the doc, but it doesn't.

Any insight is appreciated!

Thanks,

© Stack Overflow or respective owner

Related posts about android

Related posts about java