May I know what is the difference between styles.xml
and themes.xml
? To me, they just look same as both XML are in the same format.
<style name="...
<item name="...
So, in my app which provide customization coloring, size, drawable, ... do I need both styles.xml
and themes.xml
as well? How should I decide which XML to put in which file?
Out of the whole page of the Styles and Themes. You may be looking for this line.
When you apply as theme, it changes everything in scope, depending if you applied it on Activity or Application. Style is more 'local'.
Taken from the Styles and Themes document, in the Defining Styles section:
Quoted from Android API guide:
Full documentation
So I guess it really doesn't matter if you put any styles in any files as long as it's an xml file which locates in
res/values/
folder.I am just realizing that for example Toolbar text colors go into a theme declaration, and for other aspects go into a style declaration
And in the toolbar declaration
I tried to omit the theme by moving its items into the style, but that didn't work. So in this case it seems as these are just styles which are as theme since they affect the inherited children in the toolbar such as the textfields.
There is no functional difference between styles.xml and themes.xml as many answers have indicated.
It is worth noting that Google's iosched2014 app has ONLY a styles.xml (no themes.xml).
https://github.com/google/iosched
Hi here is an article regarding to the difference between styles and themes XML in android please go through
And also here the android documentation regarding to styles and themes in Android.