我应该使用哪个资源限定符来支持 1080p、720p 安卓电视?- 安卓 [英] Which resource qualifier should I use to support 1080p, 720p android TV? - Android

查看:33
本文介绍了我应该使用哪个资源限定符来支持 1080p、720p 安卓电视?- 安卓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了为 1080p 和 720p android TV 定义不同的维度值,我需要决定我应该使用哪个限定符.当我尝试使用 values-sw1080p,values-sw720p 之类的东西时,它不起作用.dimes.xml 中的值不会影响任何事情.但是如果我使用像 -sw540dp,-sw360dp 这样的限定符,它就可以工作.我真的不明白为什么会这样.任何的想法?谢谢.

In order to define different dimension values for 1080p and 720p android TV, I need to decide which qualifier I should use. When I'm trying to use something like values-sw1080p,values-sw720p, it doesn't work. The values in dimes.xml doesn't affect anything. But it works if I'm using qualifier like -sw540dp,-sw360dp. I don't really understand why like that. Any idea? Thanks.

推荐答案

首先,您的观点基本正确.你可以使用

First of all, you are substantially correct. You can use

sw360dp/ : 720p screens
sw540dp/ : 1080p screens

sw720p/sw1080p 不起作用的原因是因为它们不作为限定符存在.

The reason why sw720p/sw1080p don't work is because they don't exist as qualifiers.

这是关于使用不同屏幕尺寸的官方文档.如您所见,如果您想计算 dp 文件夹,需要考虑两个不同的单位:像素数(例如 720)和像素密度(即每点-inch 单位,或多少像素适合一英寸).

This is the official documentation about working with different screen sizes. As you can read, there are two different units to take into account if you want to calculate your dp folder: the pixel count (e.g., 720) and the pixel density (that is, the dot-per-inch unit, or how many pixels fit into a single inch).

公式很简单:

px = dp * (dpi / 160)

而在这种情况下,我们有:

while in this case we have:

dp = px * 160 / dpi

当然,电视可以有不同的密度:这张表告诉你更多关于它的信息(来源:官方文档).

Of course, a TV can have different densities: this table tells you more about it (source: official documentation).

假设我们有一个具有超高密度 (@320 dpi) 的 1080p 显示器.我们做数学

Let's assume we have a 1080p display with an extra high density (@320 dpi). We do the math

dp = 1080 * 160 / 320 = 540

所以我们会得到适当的文件夹来放置您的资源.

So we get the appropriate folder to put your resources in.

EDIT:在同一页面上,声明有一个特定的 tvdpi 限定符可用于您的电视相关资源(大约 213dpi).

EDIT: on that same page, it is stated that there is a specific tvdpi qualifier that you can use for your TV-related resources (around 213 dpi).

这篇关于我应该使用哪个资源限定符来支持 1080p、720p 安卓电视?- 安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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