Skip to content

How to modify the values of the default theme

If the client wants to customize some parts of the widget, then the following the steps are needed:

  • Create a style in both day/night of its theme.xml files.
  • These styles should extend the commerce widget theme (Theme_Commerce_DayNight).
  • In those styles, the client can override any attributes of the default theme.
  • Call theme.applyStyle as shown in Theme Setup section, but this time with the newly created theme.

Create a custom theme in themes.xml file

In order to create a custom them in the themes.xml file, add the following code.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
<resources xmlns:tools="http://schemas.android.com/tools">

    <style name="Theme.Commerce.DayNight.Edited" parent="Theme.Commerce.DayNight">

        <!-- Override the desired attributes here -->

    </style>

    <!-- Base application theme. -->
    <style name="Theme.ClientTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">

        <!-- Client theme attributes -->
        .....

    </style>
</resources>