How do I apply a style to all buttons of an Android application How do I apply a style to all buttons of an Android application android android

How do I apply a style to all buttons of an Android application


For Android styles, you reference the preset attributes that Android has laid out in R.attr. In this case, it looks like you want to to reference android:buttonStyle. I think this would work:

<style name="ApplicationStyle" parent="android:Theme">  <item name="android:buttonStyle">@style/CKButton</item></style>


For Material components theme it would be like this:

<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">    <item name="colorPrimary">@color/colorPrimary</item>    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>    <item name="colorAccent">@color/colorAccent</item>    <item name="materialButtonStyle">@style/AppTheme.Button</item></style>