android - How can I calculate phone's width and height in density pixels -
for instance, have galaxy tab 2 http://www.gsmarena.com/samsung_galaxy_tab_2_10_1_p5100-4567.php has display size 800 x 1280 pixels
how can calculate , height in dp? want use relevant values in resource folder names
values-sw600dp
galaxy tab 2 has 10.1" display , 800 x 1280.
for sw (smallest width):
800 / (141/160) = 800 / 0.88125 = 907.8 dp -> fits example sw600dp. 141 - dpi of screen 160 - dpi of mdpi screen 800 - pixels in width
basicaly sw-600dp fits 7" tablets , sw-720dp fits 10" tablets.
Comments
Post a Comment