Styling indeterminate progressbar on ActionBar

后端 未结 7 1512
栀梦
栀梦 2020-12-13 02:52

I would like to put a progressBar on the action bar but setting

requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);  
setProgressBarIndeterminateVi         


        
7条回答
  •  一整个雨季
    2020-12-13 03:14

    Styled ANIMATED indeterminate progressbar icon on ActionBar:

    1.Define res/values/styles.xml (This example uses Sherlock library to provide actionbar in old Android versions so, if you arent using Sherlock you should use appropiated parents to define your custom styles):

    
    
        
    
        
    
         
    
    

    2.Define res/drawable/progress_indeterminate_custom.xml:

    
    
    
        
        
         
        
    
    
    

    3.Above code uses 2 images (ic_progress_logo1 and ic_progress_logo2) as custom progress indeterminated icon. You can use as much images/drawables as you want by adding new item elements. Also, you can apply differents effects/animations. More info here: Animation Resources

    4.Apply style you've created using AndroidManifest.xml:

    
        
            
                
                
            
        
    
    

    5.Enjoy your animated custom progress indeterminate icon :D

提交回复
热议问题