I have many images in my application. I think all the buttons I can present in 9 patch, but one The central image is to change, if the display size changes, so I wonder what is the best way to correct image size (and aspect ratio) with each display size
Its a simple The solution would be:
layout at LP = indicator .getLayoutParams (); Lp.width = (int) (disW- (disw * 0.04)); Lp.height = (int) (disW- (disw * 0.04)); Indicator.setLayoutParams (LP); If the display widescreen will be 320px, then the width and height of my image will be 307px. It is working very well except for the quality of scaled image but image quality may be bad due to the increased emulator device ... I will test it on a real device soon.
The second possibility is that I used to scale the image programmatically.
But how can I keep aspect ratio? What is the best solution to this problem?
You have to manually change the layout parameters, as you are doing in your question.
For the bitmap, you can get your width and height attributes, and therefore manually maintain aspect ratio manually.
Comments
Post a Comment