Styling indeterminate progressbar on ActionBar

后端 未结 7 1509
栀梦
栀梦 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:33

    You'll need to create your own style to apply to the ActionBar. There's a great tutorial on this on the Android Developers Blog. To style the intermediate progress bar, try using indeterminateProgressStyle and Widget.ProgressBar.Small. Here's a quick example.

    <style name="YourTheme" parent="@android:style/Theme.Holo.Light">
        <item name="android:actionBarStyle">@style/ActionBarIPS</item>
    </style>
    
    <style name="IndeterminateProgress" parent="@android:style/Widget.ProgressBar">
        <item name="android:indeterminateDrawable">@drawable/ic_launcher</item>
    </style>
    
    <style name="ActionBarIPS" parent="@android:style/Widget.ActionBar">
        <item name="android:indeterminateProgressStyle">@style/IndeterminateProgress</item>
        <item name="android:background">@color/white</item>
    </style>
    
    0 讨论(0)
提交回复
热议问题