How to customize horizontal progressbar height and/or color?

2,524 views
Skip to first unread message

Steven Wei

unread,
May 25, 2012, 8:12:11 AM5/25/12
to actionba...@googlegroups.com
Hi,

I'm currently using ActionBarSherlock with Sherlock Light theme. It's working out relatively well, however I have run into one small issue when using the horizontal progress bar within the action bar: it's very difficult to see the light blue progress bar against the gray background of the Light theme.

I was wondering whether it would be possible to increase the height (and/or the color) of the horizontal progress bar, either programmatically or by setting a style? Currently it seems like it's always drawn with a 1 pixel height.

Thanks!

Jake Wharton

unread,
May 28, 2012, 1:04:14 AM5/28/12
to actionba...@googlegroups.com
Yes it is drawn very small. You can adjust its style with the progressStyle attribute on the action bar style declared in a custom theme. There are no examples of this that I know of but you can always look at the theme and styles that come with the library for the defaults.

---
Jake Wharton
http://about.me/jakewharton

Arming Tan

unread,
Mar 25, 2013, 1:23:25 AM3/25/13
to actionba...@googlegroups.com
Hi,
   progressStyle  doesnt works。I add "     <item name="android:progressBarStyle">@style/WMS</item>", and" setTheme(R.style.Theme_Styled);",but the progressBar's height is aways  16dp;
   the style resource:
   <resources>
    
    <style name="Theme.Styled" parent="Theme.Sherlock.Light.DarkActionBar">
        <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
        <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
       
    </style>
    <style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
        <item name="background">@drawable/bg_striped</item>
        <item name="android:background">@drawable/bg_striped</item>
      
         <item name="android:progressBarStyle">@style/WMS</item>
        <item name="backgroundSplit">@drawable/bg_striped_split</item>
         <item name="android:backgroundSplit">@drawable/bg_striped_split</item>
    </style>
   
  <style name="WMS" parent="Widget.Sherlock.Light.ProgressBar.Horizontal">
        <item name="android:progressDrawable">@drawable/progress_horizontal_holo_dark</item>
        <!--item name="android:indeterminateDrawable">@drawable/abs__progress_indeterminate_horizontal_holo</item-->
        <item name="android:minHeight">48dip</item>
        <item name="android:maxHeight">48dip</item>
    </style>
</resources>

 
  


在 2012年5月28日星期一UTC+8下午1时04分14秒,Jake Wharton写道:
Reply all
Reply to author
Forward
0 new messages