Android 状态栏要求图标尺寸为 25x25dp,而指南建议尺寸为 32x32dp。谁错了?
根据android图标设计指南(此处,参见表#1),开发者需要提供状态下一尺寸的栏图标:
Status Bar 24 x 24 px (LDPI) 32 x 32 px (MDPI) 48 x 48 px (HDPI)
虽然我的测量显示状态栏始终具有 25 dp 的高度,并且期望图标为 25x25dp。这转化为这些尺寸:
Status Bar 19 x 19 px (LDPI) 25 x 25 px (MDPI) 38 x 38 px (HDPI)
以下是我获取这些尺寸的方法:
25dp * 0.75 = 18.75 => 19px (LDPI)
25dp * 1 = 25 => 25px (MDPI)
25dp * 1.5 = 37.5 => 38px (HDPI)
我已经在几款 Android 手机和模拟器上确认了计算的尺寸。
问题基本上是:为什么指南使用的尺寸与状态栏实际使用的尺寸不同?
PS 由于精确的像素控制要求,我实际上需要打破准则。我只是对这种状况感到困惑。所以解释为什么会这样对我很有帮助。
According to android icon design guidelines (here, see table #1), developer needs to provide status bar icons of next sizes:
Status Bar 24 x 24 px (LDPI) 32 x 32 px (MDPI) 48 x 48 px (HDPI)
While my measurements show that status bar always has 25 dp in height and expects icons of 25x25dp. This translates to these sizes:
Status Bar 19 x 19 px (LDPI) 25 x 25 px (MDPI) 38 x 38 px (HDPI)
Here is how I get those size:
25dp * 0.75 = 18.75 => 19px (LDPI)
25dp * 1 = 25 => 25px (MDPI)
25dp * 1.5 = 37.5 => 38px (HDPI)
I have confirmed calculated sizes on several Android phones and on emulators.
The question basically is: why guidelines use sizes different from what is really used by status bar?
P.S. I actually need to break guidelines due to precise pixel control requirements. And I just was confused by this state of affairs. So explanation of why this the way it is would really help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
实际上它是
它是 24dp 大小,2dp 填充,意味着 20dp 内容
px = dp * (dpi/160)
Actually it's
it's 24dp size with a 2dp padding , means 20dp content
px = dp * (dpi/160)
警告:无论答案在书写时是否正确,现在看起来都不正确。请参阅 https://www.google.com/design/spec/style/icons。 html 获取当前指南。
这似乎是一个错误。 (请注意,截至 2010 年 12 月 4 日,他们还交叉引用了该页面上的图 4 和图 5。)
正如 Lex 指出的,他们在 “状态栏图标”部分。
他们还规定在 25x25 的所有边上都有一个 2 像素的“安全框”,图标的形状必须适合其中,尽管看起来可以将一些与锯齿相关的内容突出显示,但仅在边上,对于这种类型的图标。 (这意味着您确实希望以 21x21 的尺寸为目标。)
Warning: regardless of whether or not the answer was correct when written, it appears not to be correct now. See https://www.google.com/design/spec/style/icons.html for the current guidelines.
It just seems to be an error. (Note that as of 2010-12-04, they've also crossed their references to figures 4 and 5 on that page.)
As Lex points out, they have the correct number further down, in the "Status bar icon" section.
They also dictate a 2-pixel "safeframe" on all sides at 25x25 which the shape of your icon must fit within, though it seems that it is okay to have some aliasing-related stuff stick out, but only on the sides, for this type of icon. (Meaning that you really want to aim for 21x21 at that size.)