On Android it is possible to make several style files, one for each version of the level of API
(16, 19, 21 ...), for each type of screen (xxxdp) and so on. But I had a question: is there any inheritance between these files?
For example: I'm working on a project where the minimum level of API
is 16 ( JellyBean
). For this, I have 3 style files: one for API 16
, one for API 19
and one for API 21
. However, within these files, I'm defining the same thing (well saying) 3 times:
API 21:
<style name="AppTheme.Base" parent="android:Theme.Material.Light.NoActionBar.TranslucentDecor">
<item name="">@color/blue_500</item>
<item name="">@color/blue_700</item>
<item name="">@color/amber_a700</item>
<!--<item name="">true</item>-->
<item name="alertDialogProTheme">@style/Theme.AlertDialogPro.Material.Light</item>
</style>
<style name="DarkToolbar" parent="AppTheme.Base">
<item name="">@color/abc_primary_text_material_dark</item>
<item name="actionMenuTextColor">@color/abc_primary_text_material_dark</item>
<item name="">@color/abc_primary_text_material_dark</item>
</style>
</resources>
API 19:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/blue_500</item>
<item name="colorPrimaryDark">@color/blue_700</item>
<item name="colorAccent">@color/amber_a700</item>
<item name="">true</item>
<!--<item name="">true</item>-->
<item name="alertDialogProTheme">@style/Theme.AlertDialogPro.Material.Light</item>
</style>
<style name="DarkToolbar" parent="AppTheme.Base">
<item name="">@color/abc_primary_text_material_dark</item>
<item name="actionMenuTextColor">@color/abc_primary_text_material_dark</item>
<item name="">@color/abc_primary_text_material_dark</item>
</style>
</resources>
API 16:
<resources>
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/blue_500</item>
<item name="colorPrimaryDark">@color/blue_700</item>
<item name="colorAccent">@color/amber_a700</item>
<!--<item name="">true</item>-->
<item name="alertDialogProTheme">@style/Theme.AlertDialogPro.Material.Light</item>
</style>
<style name="DarkToolbar" parent="AppTheme.Base">
<item name="">@color/abc_primary_text_material_dark</item>
<item name="actionMenuTextColor">@color/abc_primary_text_material_dark</item>
<item name="">/abc_primary_text_material_dark</item>
</style>
</resources>
My question is: If I only set the colors used in colorPrimary
, colorPrimaryDark
and colorAccent
, and set the DarkToolbar
style only once, I need to reset them for each summer of API, in other words, re-assign the values for each version of Android that my app supports?
Edit: When I try to run the application using the XMLs above, I received an error saying that I should use the "AppCompat" theme instead of the "Material" theme, but the phone I'm testing is API 21 (Android 5.0) should support the Material theme. Any tips on what it might be?