1

I am developing app.I have only layout folder with xml files,it is showing properly in more pixel screen ,but when i see my app in less pixel screen the text is big not same as more pixel screen As per android developer site, I came across layout-sw320dp ,layout-sw480dp. So I have added the xml files into layout-sw320dp,layout-480dp and made changes like text size and margin,then when i run them with sw-320dp in less pixel screen i can see text size same as more pixel screen,but when i run with sw-320dp the same in more pixel screen, the text is small ,it is taking layout from only sw320 actually it should take from layout folder.I d'not know where I am wrong can any one tell me.

screens with only layout folder 
[![screen in less pixel density[![screen with more pixel][1]][1]][2]

screens with layout-sw320sp

[![screen in less pixel [![screen with more pixel density][3]][3]density][4]][4]


  [1]: http://i.stack.imgur.com/6rTNw.png
  [2]: http://i.stack.imgur.com/uHRkx.png
  [3]: http://i.stack.imgur.com/qhcmk.png
  [4]: http://i.stack.imgur.com/Z5PE0.png
Sanjeev
  • 307
  • 2
  • 5
  • 24

1 Answers1

0

You are not supposed to pick what resource size is shown, android does that depending on the device used at runtime. Your job is to set the resource in the correct folder for example res/layout/mylayout.xml and res/layout-sw480dp/mylayout.xml res/layout-sw320dp/mylayout.xml sw is smallest width of screen, 320 is a number, dp can be thought of as pixels. This concept of putting resources in folders with special names and allowing android to pick the most sutable special name/folder for the job works for any resource. Strings/languages, images/for device screen size,night/day,orientation-|.

Pomagranite
  • 680
  • 5
  • 11