1

GIVEN:

Starting with API Level 13 (Android 3.2), the screen sizes (small,normal,large,xlarge) are deprecated in favor of using the swdp qualifier. It is strongly recommended that applications that are meant to run on Android 3.2 or higher should be using these newer qualifiers. http://developer.android.com/guide/practices/screens_support.html

THEN:

What is the best practice for maintaining compatability with api 7+ without making the problem even more complicated by using BOTH techniques at the same time?

To clarify: When creating resource folders for alternate layouts, dimensions,values, etc, with the requirement of supporting api 7+, should we use the deprecated qualifiers (small, normal, large, xlarge) or the new qualifiers (sw600dp, sw800dp etc) or both at the same time?

update: I just found a similar question where the accepted answer suggested using ONLY the older Abstract Size Bin qualifiers: https://stackoverflow.com/a/15113877

Community
  • 1
  • 1
JohnRock
  • 6,795
  • 15
  • 52
  • 61
  • This is a pretty broad question. But in short, the BEST thing to do is create a seperate layout XML for all screens, and all orientations. That way you have control over what your app looks like no matter what. Most people don't have access to enough devices to test this completely. But that's the basic concept. – durbnpoisn Jun 19 '14 at 15:35
  • I have updated my question in hopes of clarifying it a bit. Thanks – JohnRock Jun 19 '14 at 15:44

1 Answers1

1

Use layout aliases.

Quotation from the official documentation:

"The smallest-width qualifier is available only on Android 3.2 and above. Therefore, you should also still use the abstract size bins (small, normal, large and xlarge) to be compatible with earlier versions."

Here is the link for more information - Use Layout Aliases

janzoner
  • 1,420
  • 1
  • 11
  • 19
  • Yes I understand that. But then why ever use the smallest-width qualifier at all if you are still using the Abstract size bins? It seems wrong to deprecate something and then have the best practice be to continue using the deprecated standard while adding the new standard on top. How do you know then which layout is used if you have layouts for large, xlarge, and sw600dp? Very confusing. – JohnRock Jun 19 '14 at 16:03
  • Newer Android versions use newer "folders" e.g. sw600dp and older versions simply ignore them because they even don't recognize them. – janzoner Jun 19 '14 at 16:14
  • Yes. Got it. But why would you bother creating a sw600sp qualified layout if you already accounted for a tablet layout in an xlarge qualified layout? – JohnRock Jun 19 '14 at 17:10
  • @TheLizardKing Another quotation from the official documentation says: "One of the difficulties developers had in pre-3.2 Android devices was the "large" screen size bin, which encompasses the Dell Streak, the original Galaxy Tab, and 7" tablets in general. However, many applications may want to show different layouts for different devices in this category (such as for 5" and 7" devices), even though they are all considered to be "large" screens. That's why Android introduced the "Smallest-width" qualifier (amongst others) in Android 3.2." – janzoner Jun 19 '14 at 17:18
  • @TheLizardKing BTW, I think my answer suits your question and thus you should upvote it at least. – janzoner Jun 19 '14 at 17:25
  • You have provided great references to the documentation. I would have to assume from that that your answer is that you believe the best practice is to use both the deprecated old qualifiers and the new qualifiers together. This is something that I am hoping to avoid as it is so messy and confusing but I wanted to see if there was a consensus on the best way to go about it. – JohnRock Jun 19 '14 at 17:48
  • @TheLizardKing It is all about which devices you want to support. – janzoner Jun 19 '14 at 19:13