Friday, June 1, 2012

What Does Android Do Automatically To Support Multiple Screen-Sizes?

Once the build declares that it supports the various screen-sizes using the "supports-screens" settings in the manifest, the code will do the following automatically:
  • Scales images by automatically compensating for the screen-density
  • Also, getIntrinsicWidth and getIntrinsicHeight on a Drawable returns the dimensions of the image post-scaling, so pixel measurements based on what these return will still work.
  • Automatically scales dip settings in layout XML files.
Hence, the remaining needs to be done for rendering done in code:
  • All pixel calculations to compensate for screen density.
  • Pixel positions specified in draw calls to be compensated for screen density.

No comments:

Post a Comment