List of usage examples for android.graphics.drawable StateListDrawable setColorFilter
public void setColorFilter(@ColorInt int color, @NonNull PorterDuff.Mode mode)
From source file:com.varejodigital.activities.DetailActivity.java
private void updateBackground(View view, Palette palette) { int lightMutedColor = palette.getLightMutedColor(getResources().getColor(R.color.accent)); int mutedColor = palette.getMutedColor(getResources().getColor(R.color.accent)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { RippleDrawable ripple = (RippleDrawable) view.getBackground(); GradientDrawable rippleBackground = (GradientDrawable) ripple.getDrawable(0); rippleBackground.setColor(lightMutedColor); ripple.setColor(ColorStateList.valueOf(mutedColor)); } else {//from ww w . j ava 2 s.com StateListDrawable drawable = (StateListDrawable) view.getBackground(); drawable.setColorFilter(mutedColor, PorterDuff.Mode.SRC_ATOP); } }