I would like to know how to change the Floating Action Button color from the Support library 22.2.0 ? I've tried
button.setBackgroundColor(color);
but clearly, this changes the drawable of the button and it turns to a square.
Now I wonder how to change the color but just the color, without touching the shape?
Thanks in advance
Try this code. It will add a tint to the background resource.
If you are use Xamarin for android app then try below code
"#000000" used for black color you can changed according to your requriments.
if you are using Floating action button library from https://github.com/Clans/FloatingActionButton then use this
just use this line in your xml file under floating action button
Method 1: Change floating action bar(fab) color in xml:
To change floating action bar(fab) color just follow this step
just add "app:backgroundTint="#colorcode" " in xml of floating action bar(fab) .. For example
at the place of #8393ca add any color code you want
Example as usaage..
Method 2: Change floating action bar color programmatically
just add this line on your code
Firstly create a color red in your values=>colors then add this code in your activity on create
credits : http://androidrace.com/2016/12/12/how-to-change-fabfloating-action-bar-color-android/
To do this backwards compatible: