问题
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:
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.
来源:https://stackoverflow.com/questions/19832194/how-to-create-seperate-values-folder-sony-xperia-z1-in-android