Creating styles-v21.xml

后端 未结 5 1480
余生分开走
余生分开走 2020-12-08 19:29

In Android Studio, I imported a project which did not include styles.xml (v21). So I created a styles-v21.xml file in the values direc

相关标签:
5条回答
  • 2020-12-08 19:45

    You should create styles.xml for version 21 in values-v21 folder and android studio automatically add it as styles.xml(v21)

    0 讨论(0)
  • 2020-12-08 19:46

    correction to styles-v21.xml.

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <style name="AppTheme" parent=""AppTheme.Base"">
    
        </style>
    
    </resources>
    
    0 讨论(0)
  • 2020-12-08 19:46

    You have to create a value folder with values-v21 caption. and create style.xml file in this with the same name as values folder like styles.xml. Now rebuild your project.

    0 讨论(0)
  • 2020-12-08 19:54

    Right click on res folder, choose New --> Android resource file, set the same name for the new file "styles", in Available qualifiers: choose the last item "Version" and finally set "Platform API level" 21.

    0 讨论(0)
  • 2020-12-08 19:59

    By default, Android Studio doesn't create styles.xml (v21). What you need to do is create a folder structure like the following:

    • res/values/styles.xml
    • res/values-v21/styles.xml

    And this is what you will get in Android Studio:

    Then you can defined different AppTheme for different API levels.

    0 讨论(0)
提交回复
热议问题