If you want to set primary and secondary progress color to horizontal progress bar programmatically in android then use below snippet
int[][] states = new int[][] {
new int[] {-android.R.attr.state_checked},
new int[] {android.R.attr.state_checked},
};
int[] secondaryColor = new int[] {
context.getResources().getColor(R.color.graph_line_one),
Color.RED,
};
int[] primaryColor = new int[] {
context.getResources().getColor(R.color.middle_progress),
Color.BLUE,
};
progressbar.setProgressTintList(new ColorStateList(states, primaryColor));
progressbar.setSecondaryProgressTintList(new ColorStateList(states, secondaryColor));