private void initButtonStyle() { wifiOn.getBackground().mutate().setColorFilter(buttonColor, PorterDuff.Mode.SRC_IN); mobileOn.getBackground().mutate().setColorFilter(buttonColor, PorterDuff.Mode.SRC_IN); airplaneOff.getBackground().mutate().setColorFilter(buttonColor, PorterDuff.Mode.SRC_IN); wifiOn.setTextColor(buttonTextColor); mobileOn.setTextColor(buttonTextColor); airplaneOff.setTextColor(buttonTextColor); Drawable wifi = ContextCompat.getDrawable(getContext(), R.drawable.ic_wifi_white); Drawable mobileData = ContextCompat.getDrawable(getContext(), R.drawable.ic_4g_white); Drawable airplane = ContextCompat.getDrawable(getContext(), R.drawable.ic_airplane_off); wifi.mutate().setColorFilter(buttonIconsColor, PorterDuff.Mode.SRC_ATOP); mobileData.mutate().setColorFilter(buttonIconsColor, PorterDuff.Mode.SRC_ATOP); airplane.mutate().setColorFilter(buttonIconsColor, PorterDuff.Mode.SRC_ATOP); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { wifiOn.setCompoundDrawablesRelativeWithIntrinsicBounds(wifi, null, null, null); mobileOn.setCompoundDrawablesRelativeWithIntrinsicBounds(mobileData, null, null, null); airplaneOff.setCompoundDrawablesRelativeWithIntrinsicBounds(airplane, null, null, null); } else { wifiOn.setCompoundDrawablesWithIntrinsicBounds(wifi, null, null, null); mobileOn.setCompoundDrawablesWithIntrinsicBounds(mobileData, null, null, null); airplaneOff.setCompoundDrawablesWithIntrinsicBounds(airplane, null, null, null); } }