如何在Android中创建单独的值文件夹Sony Xperia Z1 [英] How to Create Seperate Values folder Sony Xperia Z1 in android

查看:60
本文介绍了如何在Android中创建单独的值文件夹Sony Xperia Z1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Android Eclipse Project中为Sony Xperia Z1创建单独的值文件夹.我为值-sw390dp做.在该values文件夹内,我将那个dimen.xml文件用于该移动UI的大小..当我在该文件夹中更改ui大小时,它不会反映出来..但是,相反,它将自动使用values-large文件夹.因为,正在开发一个适用于所有5英寸和7英寸手机和平板电脑的应用程序..我需要将UI设置为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 索尼Xperia移动模型示例

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?

//我也已经安装了索尼xperia z1型号sdk. http://developer.sonymobile.com/knowledge-base/sony-add-on-sdk/install-the-sony-add-on-sdk/我的模拟器也可以正常工作...

// 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...

注意:我的问题只在这里.首先,我完美地为Google Nexus 7安装了UI..当我在Sony Xperia Z1 mobile中执行我的应用程序时,就会发生这种情况.

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像素,5.0英寸(〜441 ppi像素密度)=(1080 * 160)/441 = 391.83 ... =一轮= 390 dp多数民众赞成为什么我用这样的索尼Xperia Z1值-sw390dp

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

感谢进阶

推荐答案

看起来像这里的问题是您计算dp中最小宽度的方式.如您所知,Android基于密度桶系统,例如mdpi(160 dpi),hdpi(240 dpi),xhdpi(320 dpi)和xxhdpi(480 dpi)等.每个电话被归类为属于可用密度桶之一.该逻辑密度是实际物理密度的近似值.

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.

Z1的物理密度为441 ppi,因此它属于xxhdpi桶.

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

所以我们有公式:px = dp *(dpi/160)或dp = px/(dpi/160)

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

在这种情况下,dpi = 480,而px = 1080,所以:

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

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

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

因此,您应该对Xperia Z1使用values-sw360dp.

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

这篇关于如何在Android中创建单独的值文件夹Sony Xperia Z1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆