The recent announcement of the Samsung Galaxy Tab should be a wake-up call for Android developers. Whats scary is that weve never seen a concealment same this on an Android figure before. Whats reassuring is that most apps Just Work (in fact, a aggregation of the ones Ive tried so farther hit looked terrific) and the possibleness problems are cushy to avoid. Heres what you requirement to do to take advantage of not meet the Tab, but all the newborn modify factors that are coming downbound the pipe.
Lets study the Tab as a teachable moment:
Its concealment is 1024x600; no harmonious devices concealment has ever had a thousand pixels in some dimension before.
A aggregation of people are going to poverty to stop it sideways, in genre mode, most of the time.
We propose outlay calibre instance with the Developers-guide discussion of activity multiple screens; we'll be redaction that regularly when required as the figure genre changes. Also, this journal recently ran Dan Morrills One Screen Turn Deserves Another, which should help discover in direction the genre default.
What density means
When you physique your app, you crapper wage layouts and assets (graphics) which depart by concealment density, concealment size, and genre or semblance orientation. Clearly, actuation these unitedly is not as much fun as artful stylish layouts and clever Intent filters; but theres no artefact around it.
In this context, the Samsung has another little surprise: If you do the arithmetic, its concealment has 170 DPI, which is farther from the densest among Android devices. Still, it declares itself as hdpi (and as having a super concealment size). The think is simple: It looks meliorate that way.
Samsung institute that if you rendered your graphical resources bit-for-bit using medium-density sources, they looked great, but most large-screen designs ended up hunting sparse, with likewise much space between buttons and icons. At broad resolution, the support scales up the resources an amount that turns discover to be meet enough.
As a picturing hobbyist, Im reminded of how you chisel aperture and shutter pace and ISO sensitivity. If, for example, you poverty a fast shutter pace to capture a dancer in mid-leap, youd meliorate equilibrate with a wider aperture or more sensitivity. Similarly, the Galaxy Tabs concealment is at the super end of large, so declaring it as high-density applies a useful compensation.
The beatific news is that the scaling cipher in the support is sharp sufficiency and fast sufficiency that it comes discover well; the graphics in my possess apps countenance unco beatific on the Tab. Here is the front tender of my LifeSaver 2 app; first the Nexus One, then the Galaxy Tab, resized for show here. Different densities, assorted geometries, and the exclusive essential difference is that the version on the bounteous concealment looks prettier.
Your take-away should be what I said above: Make sure you wage your graphics at all threesome resolutions, and chances are the Android support module encounter a artefact to attain them countenance enthusiastic on a huge variety of devices.
Other Ways To Go Wrong
As I noted, most apps impact meet dustlike on this category of device, discover of the box, no changes required. However, we hit separate crossways a few Worst Practices that crapper attain your app countenance dorky or even broken; for example:
Using AbsoluteLayout; this is a instruction for trouble.
Using absolute kinda than density-independent pixels.
One member of my group ran crossways a pair of apps that suffered a Null Pointer Exception because they were conniving concealment filler when their Activity started, and doing their possess inventiveness weight kinda than letting the support take care of it. The difficulty was that they hadn't built in direction for the 1024x600 screen. The difficulty would vanish if they'd hand the impact to the support (or at least attain sure that all their switch statements had choice cases).
Escape the Shoebox
I've observed that a certain sort of applications materialize shoeboxed, running in a handset-like sort of pixels in the center of the screen, enclosed by a wide black band. They impact fine, but this is silly, and cushy to avoid. It turns discover that this happens when you hit a targetSdkVersion continuance inferior than four; this is understood to stingy that youre targeting the heritage Cupcake savor of Android, which exclusive based HVGA.
In some case, if you poverty to attain 100% sure that your app doesnt get pushed into the shoebox, the supports-screens element is your friend; heres what we recommend:
<supports-screens android:largeScreens="true" android:anyDensity="true" />(Both those attributes choice to "false" for API levels inferior than 4.) Given a chance, the support gets a beatific termination on nearly some Android concealment imaginable.
Testing
When a figure comes along thats assorted in digit artefact or another from whats been available before, and you dont hit one, the exclusive artefact to be sure your app module impact it right is to separate it on an Android emulator; the emulator cipher is pliant sufficiency to help anything weve seen or know is coming downbound the pipe.
In the case of the Galaxy Tab, Samsung module be providing an add-on including a custom AVD and wound as an SDK add-on, to attain your life easier; I utilised a pre-release to attain the LifeSaver screenshot above.
Why All the Extra Work?
Because, as 2010 winds down, Android isnt meet for phones, and isnt meet for things that sound in your pocket. The minor effort required to deal with this should clear off big-time in terms of gift your apps access to a aggregation of newborn kinds of devices.
Thanks
basyar.com
Tidak ada komentar:
Posting Komentar