Remove vertical padding from horizontal ProgressBar

后端 未结 22 2069
眼角桃花
眼角桃花 2020-11-28 03:30

By default the ProgressBar has a certain padding above and below the bar itself. Is there a way to remove this padding so as to only have the bar in the end?

22条回答
  •  广开言路
    2020-11-28 04:12

    A complete solution to this problem would be as follows. Just in case if someone needs code fragments, this is what I did.

    1. Copied all the 8 indeterminate horizontal progressbar drawables
    2. Edited the drawables using some image manipulator and remove unnecessary paddings
    3. Copied the drawable XML named progress_indeterminate_horizontal_holo.xml from android platform
    4. Copied the style Widget.ProgressBar.Horizontal and its parents
    5. Set the style and min_height manually in the layout

    Here is the progress_indeterminate_horizontal_holo.xml

    
    
    
    
    
    
    
    
    
    

    Style resources copied to my local styles file.

    
    
    
    
    
    

    And finally, set min height to 4dp in my local layout file.

    
    

提交回复
热议问题