How to set color to secondary drawable in progress bar

前端 未结 2 1269
滥情空心
滥情空心 2021-01-03 16:32

I have this code

 pb = (ProgressBar) findViewById(R.id.progressBar1);
    final float[] roundedCorners = new float[] { 5, 5, 5, 5, 5, 5, 5, 5 };
    ShapeDr         


        
2条回答
  •  被撕碎了的回忆
    2021-01-03 17:10

    I have also faced the same issue. I add some extra points to the above answer. The seekbar or progressbar is drawn in three layers. First layer is background layer, above that secondary progress layer, above that primary progress.

    you can set your custom color to progressbar like this

           
        
           
    
    
    

    or like Ridcully said in above answer

    It happens that some android os versions do not use the background color of secondary progress. I have checked on android 4.1.2 samsung 8 inch tablet. It doesnot work. In that scenario use background to set your custom color for the secondary progress by setting background, secondary progress color

提交回复
热议问题