简体   繁体   English

我的布局混乱-Android

[英]Confusion with my layouts - android

I'm currently working on my application, which tries to support different screen resolutions but I noticed a major problem with my layouts. 我目前正在处理我的应用程序,该应用程序试图支持不同的屏幕分辨率,但是我发现布局存在一个主要问题。 I'll explain: 我会解释:

I have two folders in my res folder. 我的res文件夹中有两个文件夹。 They are called "layout" and "layout-sw360dp" which is meant to support big screens like Samsung Galaxy S4, HTC One, etc. Now, when I try to run my application on my private phone, galaxy S4, the app looks fine and all of the images and the components are perfect. 它们分别称为“ layout”和“ layout-sw360dp”,旨在支持大屏幕,例如三星Galaxy S4,HTC One等。现在,当我尝试在私人电话galaxy S4上运行应用程序时,该应用程序看起来不错并且所有图像和组件都很完美。

But when I try to run my app on an HTC One device, suddenly the layout looks small, like very small. 但是,当我尝试在HTC One设备上运行我的应用程序时,布局突然变得很小,就像很小。 It supposes to fit the entire screen, like in my galaxy s4. 它假定适合整个屏幕,就像在我的银河s4中一样。 It's like HTC One and Galaxy S4 don't use the same layout folder, although their screens sizes are almost the same. 就像HTC One和Galaxy S4并没有使用相同的布局文件夹,尽管它们的屏幕尺寸几乎相同。

If you guys can clarify this matter for me I would really appreaciate that. 如果你们能为我澄清这件事,我将非常感谢。

Edit: I have tried to run my app on an Samsung Galaxy S5 device and it looks find, like the way it should. 编辑:我试图在三星Galaxy S5设备上运行我的应用程序,它看起来像是应该找到的样子。 What is the problem with HTC One? HTC One有什么问题?

Physical size is usually measured in inches, it simply tells you the real device's screen size 实际尺寸通常以英寸为单位,它只是告诉您实际设备的屏幕尺寸

dpi, is NOT correlated with it. dpi,与此无关。 Dpi expresses screen density, how many pixels are shown in a given area (usually a square inch). Dpi表示屏幕密度,即在给定区域(通常为平方英寸)中显示多少个像素。 It could be considered as a measure of screen quality. 它可以被视为衡量屏幕质量的指标。

Resolution is given by the product of the two; 分辨率由两者的乘积给出; it expresses the total number of physical pixels on a screen. 它表示屏幕上物理像素的总数。

android:anyDensity="true"

Samsung Galaxy S4, HTC One have different physical size : DIFFERENCE 三星Galaxy S4,HTC One具有不同的物理尺寸: 差异

Refer this for how to choice best resolution : DOC 请参考此内容以选择最佳分辨率: DOC

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM