Handling Android platform default styles
I'm working on an Android application that needs to support a variety of platform versions in a single APK. In the past, although the style changed slightly between Android releases, it didn't break any layouts.
With the release of Android 4.0 (Ice Cream Sandwich) the system default style was significantly changed and the transparent backgrounds of the new widgets make it impossible to read text in some color schemes:
Android 4.0 (Same exact APK)
Since the 4.0 layout has a transparent background, it's impossible to see the black text.
Is there any easy way to handle these default style changes without creating custom styles for every basic android widget? or is it possible to request an older system theme in Android 4.0? I'm trying to avoid having to detect the system version and change font colors at runtime.
Well older themes are there. Are you settings the theme in the application? If not it will go to the device default theme.
Try setting the theme explicitly like Theme.Black, Theme.Light etc. for your activity. Use themes as your base/parent theme and then if want you can add your specific styles or override some defaults.
you can set the theme for activity in the manifest file.
If you want to support Holo theme, then first choose your parent themes once for Holo and another non-holo and then choose the appropriate theme in the code via
if(Build.VERSION.SDK_INT > 10) context.setTheme(<res_id_of_holo_them); // or dont any thing if default theme works for u else context.setTheme(<other_theme>);
Call this before setContentView