Styles and themes on values, values-v11 and values-v14 folders

后端 未结 1 1205

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 fo

相关标签:
1条回答
  • 2020-12-08 10:27

    More generally, my question is, are these 3 folders working as parent and child?

    Those folders work with a "most specific" matching system meaning it will match the closest(lower) API level values folder:

    • values-v14 targets APIs >= 14(it will not be selected at all for versions below 14)
    • values-v11 targets APIs between(and including) 11 and 13 if values-v14 is present otherwise it will match every version starting with 11 and above((it will not be selected at all for versions below 11))
    • values is the default folder and it will be the last to be matched, covering other APIs levels not covered by another values-xx folder. You should always(as with all resources folders) have this folder in your app

    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?

    Yes, this is how the Android project template is built(when you use Create new project...), it actually tells you to use the values-xx folders for customization(different look, use of newer styles, attributes):

     <!-- in the styles.xml from the v-14 values folder: -->
     <!-- API 14 theme customizations can go here. -->
    
    0 讨论(0)
提交回复
热议问题