To make a note, the main thing is to use clipdrawable, layerdrawable:
PRIVATE VOID SETPROGRESSBG (int progress) { int a = Progress * 255 / 100; int color = color.argb (A, 255, 90, 147); colordrawable colordrawable = new Colordrawable (); colordrawable.setcolor (color); clipdrawable clipdrawable = new clipdrawable (colordrawable, gravity.left, Clipdrawable.horizontal); drawable drawable = getresources (). getDrawable (r.color.transparent); drawable[] layers = new drawable[]{drawable, Clipdrawable}; layerdrawable layerdrawable = new layerdrawable ( layers); layerdrawable.setdrawablebylayerid (0,drawable); Layerdrawable.setdrawablebylayerid (1,clipdrawable); progressbar.setprogressdrawable (clipdrawable); Progressbar.setprogress (0); progressbar.setprogress (progress); LOGER.D ("Vote vote", "result = " + progress);     LOGER.D ("Vote vote", "a = " + a);}
This article from the "Sky no traces but I flew" blog, please be sure to keep this source http://glblong.blog.51cto.com/3058613/1739160
Android Note: Change the ProgressBar background color according to the progress code, clipdrawable,layerdrawable,setprogressdrawable