Wednesday 17 August 2016

Screen Size



Android categorizes device screens using two general properties: size and density.

+         There are four generalized sizes: small, normal, large, xlarge
+       There are four generalized densities: low (ldpi), medium (mdpi), high (hdpi), extra high (xhdpi)
+       and five different screen size layout : layout, layout-large, layout-land, layout-large-land.
Note : To support different screen, Use different image size in different directory.

Create Different Layouts

System loads the layout file from the appropriate layout directory based on screen.

project               --- >           Resource           --- >
1. layout                                :                              for normal screen [default (portrait)]
2. layout-large                   :                              for large screen like tablet
3. layout-land                    :                              for landscape ( Horizontal orientation ) device.
4. layout-large-land/       :                               large landscape


Create Different Bitmaps

low, medium, high and extra-high density. This helps you achieve good graphical quality and performance on all screen densities.
To generate these images, you should start with your raw resource in vector format and generate the images for each density using the following size scale:
·         xhdpi  (Xtra High Definition Pixel )  : 2.0                                        200*200 pixel
·         hdpi  ( High Definition Pixel )          : 1.5                                         150*150 pixel
·         mdpi  ( Medium Definition Pixel )    : 1.0 (baseline)                         100*100 pixel
·         ldpi   ( Low Definition Pixel )           : 0.75                                       75*75 pixel

Placing images to different directory like -
my project          --- >             resource

drawable-xhdpi              :           Bigger Size Image

drawable-hdpi               :           Big Size IMAGE

drawable-mdpi              :           Medium Size Image

drawable-ldpi                :           Low Size Image

mipmap/              :      directories for launcher icons

Any time you reference @drawable/awesomeimage, the system selects the appropriate bitmap based on the screen's density.

 Note: Low-density (ldpi) resources aren’t always necessary. When you provide hdpi assets, the system scales them down by one half to properly fit ldpi screens.

 

 

 





No comments:

Post a Comment