I\'d like to change the color of a standard Android button slightly in order to better match a client\'s branding.
The best way I\'ve found to do this so far is to c
This is my solution which perfectly works starting from API 15. This solution keeps all default button click effects, like material RippleEffect
. I have not tested it on lower APIs, but it should work.
All you need to do, is:
1) Create a style which changes only colorAccent
:
I recommend using
ThemeOverlay.AppCompat
or your mainAppTheme
as parent, to keep the rest of your styles.
2) Add these two lines to your button
widget:
style="@style/Widget.AppCompat.Button.Colored"
android:theme="@style/Facebook.Button"
Sometimes your new
colorAccent
isn't showing in Android Studio Preview, but when you launch your app on the phone, the color will be changed.