I'm making simple chat app right now with code at other guy's blog.
At this blog, this guy is using style.xml. But I installed latest Android studio, so I have only themes.xml
. And I have no idea how to use themes.xml.
Is there any problem if I delete themes.xml
and make new style.xml
?
I made new styles.xml
and got colorprimary error. So this error come from 'MaterialComponents' not from styles.xml
or themes.xml
right?
The filename is not relevant.
You can create a file in res/values/custom_styles.xml
and put there the <style>
resources
Currently the newer templates provided by AndroidStudio make use of themes.xml
instead of styles.xml
. Just use them in the same way.
In res/values/themes.xml
:
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
</style>
In res/values/colors.xml
:
<resources>
<color name="colorPrimary">#......</color>
<!-- .... ->
</resources>