根据接口给的色值动态修改Progressbar进度颜色

 LayerDrawable drawable = (LayerDrawable) mItemProgressbar.getProgressDrawable();
 GradientDrawable gradientDrawable = new GradientDrawable();
 gradientDrawable.setColor(Color.parseColor("接口返回的颜色值"));
ClipDrawable clipDrawable = new ClipDrawable(gradientDrawable,Gravity.START,ClipDrawable.HORIZONTAL);
drawable.setDrawableByLayerId(android.R.id.progress,clipDrawable);

只需要将setColor()方法中的参数换成你自己想要的色值就OK了

你可能感兴趣的:(根据接口给的色值动态修改Progressbar进度颜色)