Link to home
Start Free TrialLog in
Avatar of jbajaj
jbajaj

asked on

Image padding

I am stuck on this very important part and which is ruining my system.

Presently to maintain the aspect ratio Android changes the image width and height of an image i.e it pads it to maintain the aspect ratio

How can I know how many lines of pixels were added. Is there an API, formula ?

The reason is that my application adds tags to an image with x, y information on another platform . When I open it on my ANdroid device the image resolution is changed, so my tags look out of place. If I know how android calculates this I can apply the same for the orientation of my tags and work around

Your help would be greatly appreciated..Thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of oleggold
oleggold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of UnConn
UnConn

I think you have two choices.

- Make your layout scale.  Do not put your tags in postitions relative to pixels as they can change between device screen sizes.  Android programing best practices state this too.  If you use a layout that scales then the layout should scale relative to the image.

- Use PS instead of PX.  PX uses pixels but PS uses the scaled resolution based on DPI.
Avatar of jbajaj

ASKER

Hi oleggold,

  I didn't get any idea from http://www.codeweblog.com/stag/android-alchemy-formula-list/   site. Please
explain me how this site will help me. Or if you have any idea then please explain me.

Thank you.
There is one more option and this is providing graphics for each version of the screen you will support, LDPI, MDPI, and HDPI.  This assumes you are running on 1.6 and above (minSdkVersion="4")
Avatar of jbajaj

ASKER

good