6

I am having problem differentiating layout folders for samsung galaxy s4 and samsung galaxy s3. I have tried layout-sw360dp, layout-sw360dp-xxhdpi, layout-sw360dp-xhdpi etc. All the time galaxy s4 and galaxy s3 both picks from layout-sw360dp-xhdpi.

So what should be the correct layout folder for both of these devices ?

enter image description here

Rohit
  • 2,538
  • 6
  • 28
  • 41
  • you say that all the time s4 and s3 both picks from layout-sw360dp-xhdpi -> is that a bad thing ? why would you like to do different xml files, is not looking alright on every device ? – Hitman Dec 10 '13 at 07:44
  • 2
    might problem in folder name formation, check if its ok to use densities qualifier with **'layout-x-x'** coz i search for the case and found it is use with **'drawable-x-x'** i.e **'drawable-sw800dp-hdpi'** – KumailR Dec 10 '13 at 07:46
  • @Hitman yes, my need is to differentiate s4 from s3. Also, any layout wont look same on both of these devices. – Rohit Dec 10 '13 at 07:51
  • this will give you some help, http://stackoverflow.com/questions/11699761/android-s3-layout-vs-galaxy-nexus-layout – KumailR Dec 10 '13 at 08:00
  • @smkrn110 Thx, I checked that but still not working. – Rohit Dec 10 '13 at 08:12
  • the case you have post is face by many out there, actually you have only one way left, to do it using code. get model number and set layouts respectively. **you have same screen specification for both mobiles but different dpi. (i.e xdpi and xxdpi)** (dats why 'layouts-sw360dpi-????' maps to any one folder) – KumailR Dec 10 '13 at 08:40
  • @smkrn110 Thx for your suggestion. I was testing on emulators, but I borrowed my friends Xperia Z and surprisingly, it took layout from 'layout-sw360dp-xxhdpi' and on my nexus 4 which is identical to galaxy s3 it took from 'layout-sw360dp-xhdpi'. – Rohit Dec 10 '13 at 09:01
  • ok thanks rohit, I will do R&D for the case to find the solution. Incase you resolve by yourself must share it. – KumailR Dec 10 '13 at 10:29

2 Answers2

2

I am using some specific resolution values in my projects in order to differentiate these from other layouts and screens.

You can create layouts with exact minimum height and width values that can be seen from gsmarena.

Samsung S3: http://www.gsmarena.com/samsung_i9300_galaxy_s_iii-4238.php

S3 layout folder name: layout-w720-h1280

Samsung S4: http://www.gsmarena.com/samsung_i9500_galaxy_s4-5125.php

S4 layout folder name: layout-w1080-h1920

So they will be using corresponding layouts by creating layout folders like these.

canova
  • 3,965
  • 2
  • 22
  • 39
1

The Galaxy S4 has a Full HD screen, you could create a separate layout for this resolution by using layout-xxhdpi for the S4 and layout-xhdpi for the S3.

Mark Buikema
  • 2,483
  • 30
  • 53