Oleksandr has given a great answer, just in case you are using indeterministic progressbar, that method will not work for it.
Here's code with all different methods available to use.
Method setInDeterminateProgressTintMethod = null;
Method setProgressTintMethod = null;
Method setProgressBackgroundTintMethod = null;
try {
setInDeterminateProgressTintMethod = RemoteViews.class.getMethod("setProgressIndeterminateTintList", int.class, ColorStateList.class);
setProgressTintMethod = RemoteViews.class.getMethod("setProgressTintList", int.class, ColorStateList.class);
setProgressBackgroundTintMethod = RemoteViews.class.getMethod("setProgressBackgroundTintList", int.class, ColorStateList.class);
} catch (SecurityException|NoSuchMethodException ex) {
ex.printStackTrace();
// do nothing if we can not apply progress bar tint.
}
if (setInDeterminateProgressTintMethod != null) {
try {
Log.d(TAG, "Invoking setTintMethod");
setInDeterminateProgressTintMethod.invoke(remoteViews, resId, ColorStateList.valueOf(Color.parseColor("#yourhexcolor")));
setProgressTintMethod.invoke(remoteViews, resId, ColorStateList.valueOf(Color.parseColor("#yourhexcolor")));
setProgressBackgroundTintMethod.invoke(remoteViews, resId, ColorStateList.valueOf(Color.parseColor("#yourhexcolor")));
} catch (IllegalAccessException|InvocationTargetException ex) {
Log.d(TAG, "Exception in setting tint for progressbar: "+ ex.getMessage());
ex.printStackTrace(); // do nothing if we can not apply progress bar tint.
}
}