简体   繁体   中英

How to design application to support multi-screen devices and tablets in Android

If an application have to support starting from android 1.6 device and onwards. The application also have to support tablets. what are the things i have to consider while creating the app. I have read How to Support Multiple Screens . I think the summary as described there is

  • Explicitly declare in the manifest which screen sizes your application supports (summary-1)
  • Provide different layouts for different screen sizes (summary-2)
  • Provide different bitmap drawables for different screen densities(summary-3)

As I have to support all devices starting from 1.6 onwards including tablets whether I have to use <supports-screens> . Is it useful for my applicaiton? (summary-1)

I cannot create layout for different size. because the in future any device may come with some different_size. But I have to support all screen size. (summary-2)

I understood that I have to create different drawable folders to support different resolution and also to support multi-size i have to create all images as 9-patch. (summary-3)

Only I understood the use of (Provide different...) for my application. I didn't get the use of other two points for my problem. Also a doubt here is that is it ok if i create hdpi, ldpi and mdpi drawable folder or I need to create xhdpi also?

Can anyone suggest me what are the other things i have to take into consideration If I want my app should look same and work as same in such a wide range of devices (from 1.6+ to tablets also)

You mostly got it covered.

Use only high resolution resolution images might save you some head ache, both in supporting and app size. Mdpi-screens will automatically scale down these images. You might loose pixel-perfection, but imo anyone using mdpi-screens do not care about such perfection ;) Either way they are a small part of the market.

Also it should be sufficient with only one layout for every screensize , unless your layout is very, very complex. You should never define the layout in absolute pixels (px). Use dimensional pixels (dp). And if you need to center something, dont just set the distance from the left side so it gets placed in the center, use android:layout_centerHorizontal="true" and corresponding attributes so it will always center for all screen sizes.

I believe 1.6 have a shit-ton of bugs in the layout. I would suggest not supporting 1.6 if you can, or be prepared for a bunch of potential problems. I googled and only found a few, but I remember from the good old 1.6-days that there are a bunch more.

Example of small layout-bug in 1.6: http://code.google.com/p/android/issues/detail?id=15482

Example of HUGE layout-related bug in 1.6: http://developer.android.com/guide/topics/resources/providing-resources.html#KnownIssues

They claim it to be a non-issue, but you might require to keep multiple copies of each image, since 9-patch images breaks when referenced through an xml-file (atleast in 1.6).

Test it on emulators with weird resolutions to check that your solution works, before releasing the app. :)

You should always define <supports-screens> in your manifest because the default values can change from one version to another.

But if you want to support xlarge screens then you're stuck because this attribute was introduced in API level 9 (android 2.3). You have to create two different APKs, one for android versions >= 2.3 and the other for the older ones.

Since it's a common issue, android provides a nice way to publish only one application on the market even if you use multiple APKs.

However Android 1.6 represents about 1.3% of the market share right now. Are you sure you want to spend a lot of time to support this old version?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM