Android: providing different layout resources for older versions
To provide backward compatibility with older phones still running on Android 1.5 you might have to provide separate layout resources for Android 1.5 and Android 1.6+. Especially when dealing a lot with RelativeLayout, which was basically crap before Android 1.6.
Instead of having one res/layout folder we will create two new folders:
- res/layout-v3 for Android 1.5
- res/layout-v4 for Android 1.6 and higher
Bug in Android 2.0
There seems to be a bug in Android 2.0. Instead of picking the resource from res/layout-v4 as it should and if it doesn't find it there then from res/layout-v3, it expects the the resource wrongly in the default res/layout folder. To make it work you should rename res/layout-v3 back to res/layout again (or just create a symlink). The second problem or bug that comes with it, is to provide the special resources for Android 2.0 or higher. Instead of providing those in res/layout-v5 Android 2.0 expects wrongly res/layout-v6. So just use this instead for now. The bug is fixed in Android 2.0.1, but there are still quite some Android 2.0 phones out there.
I hope this post is not too confusing ;-)

0 comments:
Post a Comment