How to Customize a Progress Bar In Android

前端 未结 9 2393
鱼传尺愫
鱼传尺愫 2020-11-22 16:07

I am working on an app in which I want to show a ProgressBar, but I want to replace the default Android ProgressBar.

So how can I customize

9条回答
  •  执笔经年
    2020-11-22 16:31

    Customizing the color of progressbar namely in case of spinner type needs an xml file and initiating codes in their respective java files.

    Create an xml file and name it as progressbar.xml

    
    
    
        
    
            
            
        
    
    
    

    Use the following code to get the spinner in various expected color.Here we use the hexcode to display spinner in blue color.

    Progressbar spinner = (ProgressBar) progrees.findViewById(R.id.spinner);
    spinner.getIndeterminateDrawable().setColorFilter(Color.parseColor("#80DAEB"),
                    android.graphics.PorterDuff.Mode.MULTIPLY);
    

提交回复
热议问题