简体   繁体   English

Windows Universal密度独立像素

[英]Windows Universal density indepentent pixels

In Windows Store and Windows Phone (Windows Universal) 8.1 applications is there something that is similar to using DP to indicate object sizes, like in android? 在Windows Store和Windows Phone(Windows通用)8.1应用程序中,有什么类似于使用DP来指示对象大小的东西,例如android? In android it works like this: DP is density indepentent pixels. 在android中,它的工作方式如下:DP是密度无关的像素。 Which means that on every screen, independent of size of the screen, DP is rougly the same. 这意味着,在每个屏幕上,DP均与屏幕大小无关,与屏幕大小无关。 In this way you can create your application in such a way that it looks the same on every screen. 这样,您可以以在每个屏幕上看起来都一样的方式创建应用程序。

So far I haven't been able to find something similar for Windows Store and Windows Phone (Windows Universal) applications. 到目前为止,我还无法为Windows Store和Windows Phone(Windows Universal)应用程序找到类似的东西。 So far I've just been using grids with either "auto" or " (number here)*" sizes. 到目前为止,我一直在使用大小为“自动”或“(此处为数字)*”的网格。 However I need a static size for my buttons, because that is how it has been designed. 但是,我需要为按钮设置一个静态尺寸,因为这是设计方式。 I can not simply put them on 10 pixels (for example), because then the physical size would vary per screen. 我不能简单地将它们放在10像素(例如)上,因为那样一来,每个屏幕的实际尺寸都会有所不同。

Source on android DP: http://developer.android.com/design/style/metrics-grids.html android DP上的源代码: http : //developer.android.com/design/style/metrics-grids.html

Apparently there is no such thing. 显然没有这样的事情。 However in Windows Phone there is something similar. 但是,在Windows Phone中有类似的东西。 Windows Phones can have a couple of resolutions, but apps assume that the screen is 400x800 (in most cases, sometimes it's actually 400x856 or something). Windows Phone可以有几种分辨率,但是应用程序假定屏幕为400x800(在大多数情况下,有时实际上是400x856左右)。

For applications running on your windows pc or windows tablet, however, this is not the case. 但是,对于在Windows PC或Windows Tablet上运行的应用程序,情况并非如此。

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

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