I am currently working on my app to base its design on the Holo theme. Globally what I want to do is working but I am a little confused about the way that are working the folders values
, values-v11
and values-v14
.
So I know that:
values
is targeting the API inferior to 11
values-v11
is targeting the API between 11 and 13
values-v14
is targeting the API superior to 13
At first I thought I had to specify for every folder all the styles needed for the app but then I realized a kind of inheritance system was in place.
My problem is that I am really confused and don't understand clearly how is working this inheritance between these 3 folders.
I did the following test in order to see the behavior on my phone (running on Android 4.0, so the folder values-v14
should be the one loaded):
In values
I have a style to set in blue the text color:
<style name="TextMedium" parent="@android:style/TextAppearance.Medium">
<item name="android:textColor">@color/Blue</item>
In values-v11
I have a style to set in white the text color:
<style name="TextMedium" parent="@android:style/TextAppearance.Medium">
<item name="android:textColor">@color/White</item>
In values-v14
I have a style to set in red the text color:
<style name="TextMedium" parent="@android:style/TextAppearance.Medium">
<item name="android:textColor">@color/Red</item>
For the first case above (every folder with a different color), the color loaded on my text is red, meaning the values-v14
folder gets the priority.
Then if I comment out the red style from the values-v14
folder, the text becomes white. Does that mean that the system will take the style in the values-v11
folder even if the device is targeting the values-v14
folder? I thought it would maybe use the values
folder by default but not values-v11
.
More generally, my question is, are these 3 folders working as parent and child?
Meaning that:
- If the device is running on a API version > 13, the system will load
values-v14
then values-v11
and finally values
.
- If the device is running on a API between 11 and 13, the system will load
values-v11
and then values
.
- If the device is running on a API version < 11, the system will load only
values
.
If it is indeed the way it is working, does it make sense then to setup the maximum of styles in the parent folder values
and add only specific ones in v11 or v14?
Sorry for the long question, I hope it is clear, this themes/styles system is only described briefly in the Android guide and it is difficult to find information on how it works...
Thanks for your help!
See Question&Answers more detail:
os