I've created a brand new app using the basic activity. I want to change the colour of all buttons (from the default primary colour of purple to a custom non-primary colour of green). Here's my themes.xml:
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.MyApplication" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<item name="buttonStyle">@style/ButtonColour</item>
<!-- Customize your theme here. -->
</style>
<style name="Theme.MyApplication.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="ButtonColour" parent="Widget.MaterialComponents.Button">
<item name="backgroundTint">#689f38</item>
<item name="rippleColor">#c5e1a5</item>
</style>
<style name="Theme.MyApplication.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="Theme.MyApplication.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
where I apply the ButtonColour
style, as defined in the android dev docs here: https://developer.android.com/guide/topics/ui/look-and-feel/themes#Widgets
When the app is ran with that custom style to change the buttons to green, the buttons are still the default primary colour.
I've read other questions (1, 2, and 3) but none of their solutions helps either. Does anyone have any guidance on how this can properly be done?