سؤال

I'm developing an app and I encountered a serious problem (really big failure in Android in my personal opinion). If you try to support multiple screens prior to API 13 (that the "small width" feature was added), you have to use the screen size (small, medium etc) and density (ldpi, mdpi etc) to supply different layouts for different screens. All working well and good, until you want to support both 10" tablets and 7" tablets. For example, a 10" tablet with 1280X800 resolution and a 160 density (most of tablets), and Kindle (1024x600, density 160, 7') are the same for Android, that means that prior to API 13 (not all tablets run 3.2 yet) I can't supply different layouts/dinmension values for each one of them seperately.

I really don't want to do all the nasty calculations inside the code just for determining the size of the text. I'm pretty sure that a lot of people encounter this problem.

Does anyone knows a solution for this?

Thanks, Elad

هل كانت مفيدة؟

المحلول

Using the old qualifier system, a 7" tablet will register as a large screen and a 10" tablet will register as an xlarge screen (the latter qualifier introduced in Gingerbread).

Edit: From the latest Android Compatibility Definition Document (CDD):

Specifically, device implementations must report the correct screen size according to the following logical density-independent pixel (dp) screen dimensions.

  • Devices MUST have screen sizes of at least 426 dp x 320 dp ('small')
  • Devices that report screen size 'normal' MUST have screen sizes of at least 470 dp x 320 dp
  • Devices that report screen size 'large' MUST have screen sizes of at least 640 dp x 480 dp
  • Devices that report screen size 'xlarge' MUST have screen sizes of at least 960 dp x 720 dp

Devices wishing to be eligible for Google Play must adhere to this document's rules. Technically, devices like the Kindle Fire aren't required to follow these rules since they use their own app store, but I have not personally seen them stray. The Fire by these rules is large because it's smallest width is < 720dp.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top