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
Mike, you might be interested in color filters.
An example:
button.getBackground().setColorFilter(new LightingColorFilter(0xFFFFFFFF, 0xFFAA0000));
try this to achieve the color you want.
The shortest solution which is working with any Android version:
<Button
     app:backgroundTint="@color/my_color"
Notes/Requirements:
app: namespace and not the android: namespace!appcompat version > 24.2.0
dependencies { compile 'com.android.support:appcompat-v7:25.3.1' }
Explanation:
You can Also use this online tool to customize your button http://angrytools.com/android/button/  and use android:background="@drawable/custom_btn" to define the customized button in your layout.
You can set theme of your button to this
<style name="AppTheme.ButtonBlue" parent="Widget.AppCompat.Button.Colored">
 <item name="colorButtonNormal">@color/HEXColor</item>
 <item name="android:textColor">@color/HEXColor</item>
</style>
                                                                        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:
<style name="Facebook.Button" parent="ThemeOverlay.AppCompat">
    <item name="colorAccent">@color/com_facebook_blue</item>
</style>
I recommend using
ThemeOverlay.AppCompator your mainAppThemeas 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
colorAccentisn't showing in Android Studio Preview, but when you launch your app on the phone, the color will be changed.
<Button
    android:id="@+id/sign_in_with_facebook"
    style="@style/Widget.AppCompat.Button.Colored"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:text="@string/sign_in_facebook"
    android:textColor="@android:color/white"
    android:theme="@style/Facebook.Button" />
                                                                        Use it in this way:
buttonOBJ.getBackground().setColorFilter(Color.parseColor("#YOUR_HEX_COLOR_CODE"), PorterDuff.Mode.MULTIPLY);