You can set the color tone for drawing like this if you use API 21 or higher.
mFAB.getDrawable () mutate () setTint (GetResources () GetColor (R.color.yourColor).); ..
eg.
mFAB = (FloatingActionButton) findViewById(R.id.fab); mFAB.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Snackbar.make(v, "Yummy snackbar", LENGHT_LONG).show(); } }); mFAB.getDrawable().mutate().setTint(getResources().getColor(R.color.colorAccent));
Update: Since getColor is deprecated, you should use ContextCompat. Use the following, for example:
mFAB.getDrawable().mutate().setTint(ContextCompat.getColor(this, R.color.colorAccent));
Chris source share