Note that there are some explanatory texts on larger screens.

plurals
  1. POStyles and themes on values, values-v11 and values-v14 folders
    text
    copied!<p>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 <code>values</code>, <code>values-v11</code> and <code>values-v14</code>.</p> <p>So I know that:</p> <ul> <li><code>values</code> is targeting the API inferior to 11</li> <li><code>values-v11</code> is targeting the API between 11 and 13</li> <li><code>values-v14</code> is targeting the API superior to 13</li> </ul> <p>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.</p> <p>My problem is that I am really confused and don't understand clearly how is working this inheritance between these 3 folders.</p> <p>I did the following test in order to see the behavior on my phone (running on Android 4.0, so the folder <code>values-v14</code> should be the one loaded):</p> <p>In <code>values</code> I have a style to set in blue the text color:</p> <pre><code>&lt;style name="TextMedium" parent="@android:style/TextAppearance.Medium"&gt; &lt;item name="android:textColor"&gt;@color/Blue&lt;/item&gt; </code></pre> <p></p> <p>In <code>values-v11</code> I have a style to set in white the text color:</p> <pre><code>&lt;style name="TextMedium" parent="@android:style/TextAppearance.Medium"&gt; &lt;item name="android:textColor"&gt;@color/White&lt;/item&gt; </code></pre> <p></p> <p>In <code>values-v14</code> I have a style to set in red the text color:</p> <pre><code>&lt;style name="TextMedium" parent="@android:style/TextAppearance.Medium"&gt; &lt;item name="android:textColor"&gt;@color/Red&lt;/item&gt; </code></pre> <p></p> <p>For the first case above (every folder with a different color), the color loaded on my text is red, meaning the <code>values-v14</code> folder gets the priority.</p> <p>Then if I comment out the red style from the <code>values-v14</code> folder, the text becomes white. Does that mean that the system will take the style in the <code>values-v11</code> folder even if the device is targeting the <code>values-v14</code> folder? I thought it would maybe use the <code>values</code> folder by default but not <code>values-v11</code>.</p> <p>More generally, my question is, are these 3 folders working as parent and child? Meaning that:</p> <ul> <li>If the device is running on a API version > 13, the system will load <code>values-v14</code> then <code>values-v11</code> and finally <code>values</code>.</li> <li>If the device is running on a API between 11 and 13, the system will load <code>values-v11</code> and then <code>values</code>.</li> <li>If the device is running on a API version &lt; 11, the system will load only <code>values</code>.</li> </ul> <p>If it is indeed the way it is working, does it make sense then to setup the maximum of styles in the parent folder <code>values</code> and add only specific ones in v11 or v14?</p> <p>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...</p> <p>Thanks for your help!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload