为什么官方 Google IO 应用程序只有支持 hdpi 的可绘制对象,但在我的小型 ldpi 设备上看起来却很好?

发布于 2024-10-07 00:32:24 字数 272 浏览 2 评论 0原文

我正在查看 Android 版开源 Google IO 应用程序的源代码,我发现它们只有“drawables-hdpi”中的可绘制对象(50 个左右中只有 2 个例外)。

阅读 android 指南和文章,我开始认为我们需要支持不同的屏幕尺寸和分辨率,但是 Google 的 IO 应用程序应该反映良好的 GUI 设计模式,但只有 hdpi 的可绘制对象。

更令我困惑的是,它在我的低 dpi 小屏幕(SE Xperia X10 Mini)上看起来还不错。

有人可以澄清我的困惑吗?

I was looking at the source code of the open source Google IO App for android, and I relazied that they only have drawables in the "drawables-hdpi" (with only 2 exception out of 50 or so).

Reading the android guides and articles, I came to think that we need to support different screen sizes and resolution, but Google's IO app, which is supposed to reflect good GUI design patterns only has drawables for hdpi.

What is even more confusing to me is that it looks fine on my small low-dpi screen (SE Xperia X10 Mini).

Can someone please clarify my confusion.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

春花秋月 2024-10-14 00:32:24

这是一个新的答案,因为它的长度不能作为评论发布......Android 将负责缩放。因此,如果您自己简单地缩放图像,则无需提供不同的屏幕。请参阅 Dianne Hackborn(Android 框架工程师)的评论:

当然,如果您实际上为不同的密度生成不同的位图,那么您必须这样做,因为您想要/需要仔细控制它们的图形。然而,我最初的观点是:如果您正在做的是以一种高分辨率绘制图标,然后自动缩小这些图标以生成较低 dpi 的版本,那么非常值得考虑让平台为您进行缩放。

另请记住,对于 Nexus 7 等设备上使用的新 tvdpi 密度,我们强烈不鼓励开发人员为其生成自己的位图。让系统负责缩小这些尺寸(从您提供的 hdpi 或更高密度版本)。这就是您在 Nexus 7 附带的库存软件上看到的几乎每一个图形所发生的情况。如果它对于 N7 上发布的内容来说足够好,那么它可能对您来说也足够好。

来源:https://groups .google.com/forum/?fromgroups#!topic/android-developers/-CMgbDIo0qA%5B1-25%5D

This is a new answer because it cant be postet as comment due to its length... Android will take care of scaling. So it is not necessary to provide different screens if you just simple scale the images yourself. See this comment from Dianne Hackborn (Android framework engineer):

Sure, if you are actually generating different bitmaps for different densities, then you must be doing this because you want/need to carefully control their graphics. However my original point stands: if what you are doing is drawing your icons at one high resolution and then scaling those down automatically to generate lower dpi versions, it is well worth considering just letting the platform do the scaling for you.

Also keep in mind that for the new tvdpi density that is used on things like the Nexus 7, we strongly discourage developers generating their own bitmaps for it. Let the system take care of scaling those down (from the hdpi or higher density version you supply). This is what is happening for very nearly every single graphic you see on the stock software that comes with the Nexus 7. If it is good enough for what is shipping on the N7, it is probably good enough for you.

Source: https://groups.google.com/forum/?fromgroups#!topic/android-developers/-CMgbDIo0qA%5B1-25%5D

白日梦 2024-10-14 00:32:24

Android 自己做了很多工作,以便让内容在几乎所有屏幕上都能正常显示。

摘自:支持多个屏幕

在运行时,平台提供
为您提供三种类型的支持
应用,以确保最佳
当前设备上可能显示的内容
屏幕:

1)资源的预缩放(例如
图像资源)

2) 像素尺寸自动缩放
和坐标

3) 兼容模式显示
更大的屏幕尺寸

具体来说,由于该应用程序只有 hdpi 图像,因此它将缩小它们的尺寸,以便在 mdpi 和 ldpi 屏幕上看起来很好。

Android does a lot of work on its own in order to get stuff to look well on almost all screens.

Taken from: Supporting multiple screens

At run time, the platform provides
three types of support to your
application, to ensure the best
possible display on the current device
screen:

1) Pre-scaling of resources (such as
image assets)

2) Auto-scaling of pixel dimensions
and coordinates

3) Compatibility-mode display on
larger screen-sizes

Specifically, since that app only has hdpi images, it will downsize them to look well on a mdpi and ldpi screen.

非要怀念 2024-10-14 00:32:24

Google IO 应用程序适用于 Google IO 会议与会者。如果您还记得的话,所有与会者都会在会议上收到预装此应用程序的 HTC EVO(代替带有地图和时间表的传统活页夹)。因此,由于 EVO 是支持 hdpi 的设备,我猜他们不需要包含非 hdpi 的图标。

至于为什么它看起来不错,blindstuff 已经涵盖了。它们会针对较小的设备自动缩小图标。

The Google IO App was for the Google IO conference attendees. If you remember, all attendees received a HTC EVO at the conference that was pre-loaded with this app (in lieu of the traditional binder with maps and schedules). So since the EVO is a hdpi capable device, I'm guessing they didn't need to include icons that weren't hdpi.

As for why it looks good, blindstuff has that covered. They auto scale the icons down for smaller devices.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文