5

I have tried to Create Seperate Values folder for Sony Xperia Z1 in Android Eclipse Project. i done for values-sw390dp. inside that values folder, I put that dimen.xml file for that mobile UI sizes.. when i change ui sizes in that folder, it will not reflect it.. but, Instead of, it will take values-large folder automatically. Because, am developing an app, common for all 5 in and 7 inch mobiles and tablets.. i need to fit my UI for 5 inch and above..

http://www.gsmarena.com/sony_xperia_z1-5596.php sample sony Xperia mobile model

ALready I Refered This Site.. Sony Xperia Z density seems odd to me, will my app work fine on it?

// i have installed sony xperia z1 model sdk also.. http://developer.sonymobile.com/knowledge-base/sony-add-on-sdk/install-the-sony-add-on-sdk/ my emulator also working fine...

note : my problem is here only.. first, i fitted my UI for Google Nexus 7 Perfectly..when i executing my app into Sony Xperia Z1 mobile, this will occur..

1080 x 1920 pixels, 5.0 inches (~441 ppi pixel density) = (1080 * 160) / 441 = 391.83...= round of = 390 dp thats why i used like this for Sony Xperia Z1 values-sw390dp

Thanks Advance

1
  • hi Marlin.. did you find any solutions about this..i tried myself.. it will take from values-normal folder only..exactly dont know the sony xperia values folder sw value.. Commented Nov 11, 2013 at 5:19

1 Answer 1

6

Looks like the issue here is the way you are calculating the smallest width in dp. As you probably know, Android is based on a system of density buckets, e.g. mdpi (160 dpi) , hdpi (240 dpi), xhdpi (320 dpi) and xxhdpi (480 dpi) and more. Each phone is classified as belonging to one of the available density buckets. This logical density is an approximation of the actual physical density.

The physical density of the Z1 is 441 ppi so it falls into the xxhdpi bucket.

So we have the formula: px = dp * (dpi / 160) or dp = px / (dpi / 160)

In this case, dpi = 480 and px = 1080 so:

dp = 1080 / (480 / 160) = 1080 / 3 = 360

So you should be using values-sw360dp for Xperia Z1.

2
  • 1
    thank you Marlin. sw360 is accepted for this above mentioned model. but,the Xperia Z1 model ppi is 441 only..when I calculate like this = 1080/(441/160) = 391.83..(if round of means 390)..I did not get the 360 answer.. can u tell, how you got sw360 dp.. Commented Nov 18, 2013 at 6:00
  • 1
    As you can see in the math above, the difference is that I'm using 480 dpi vs 441. Even though the physical density of the device is 441 dpi the app resources do not use the actual physical density but rather the logical density which falls into one of the density buckets. So you need to use the value from the xxhdpi density bucket (480 dpi) rather than the physical density in your calculations. Commented Nov 18, 2013 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.