我可以知道 styles.xml
和 themes.xml
有什么区别吗?对我来说,它们只是看起来相同,因为两个 XML 格式相同。
<style name="...
<item name="...
那么,在我的应用程序中提供自定义颜色、大小、可绘制……我是否也需要 styles.xml
和 themes.xml
?我应该如何决定将哪个 XML 放入哪个文件?
最佳答案
出了Styles and Themes的整页.您可能正在寻找这条线。
When you apply a style to a single View in the layout, the properties defined by the style are applied only to that View. If a style is applied to a ViewGroup, the child View elements will not inherit the style properties—only the element to which you directly apply the style will apply its properties. However, you can apply a style so that it applies to all View elements—by applying the style as a theme.
当您应用为主题时,它会更改范围内的所有内容,具体取决于您将其应用到 Activity 还是 Application。风格更“本地化”。
关于android - styles.xml 和 theme.xml 有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15170421/