Why does the official Google IO app only have drawables that support hdpi and yet look fine on my small ldpi device?
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 ref开发者_如何学JAVAlect 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.
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
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.
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.
精彩评论