Dealing with device variations on Android
I'm an iOS developer and I'm looking into Android programming. On the iPhone I can count on pretty much one screen size on all devices, but that's not necessarily the case on Android.
How is that handled on Android? What if you need a widget to be at least some size?
Is it possible to specify a lower bound for An开发者_运维技巧droid devices that you can use your app? Can I say I'll only allow touch-screen devices with some minimum screen size and prevent people from purchasing the app if their devices don't meet the minimums I'm expecting?
Thanks!
Bill,
The android developers page has pretty good information on supporting the various screen sizes: http://developer.android.com/guide/practices/screens_support.html
And yes, you can limit your application to particular screen sizes via: http://developer.android.com/guide/topics/manifest/supports-screens-element.html
good luck!
You can restrict applications based on a range of enumerated screen sizes. The market will filter apps based on those. http://developer.android.com/guide/topics/manifest/supports-screens-element.html
Some widget design guidelines are available here. Please be aware that many custom home applications do not honor the standard sizes. http://developer.android.com/guide/practices/ui_guidelines/widget_design.html
You could specify minimum specifications for your app, but that's not necessary. The Android Developer Documentation states that applications don't work directly with resolution and pixels, but rather with density independent pixels that allow you to scale your applications across a range of screen sizes.
Android provides you with an API for getting the real pixel density of the screen as one of 4 categories (low dpi, medium dpi, high dpi, and extra-high dpi), so your application can choose to display the proper visual resources for a given pixel density. In addition, there are a number of best practices that you can use to ensure that your application scales nicely across screens.
精彩评论