造型不确定的进度在动作条不确定、进度、造型、动作

2023-09-12 01:41:38 作者:欲上青天揽明月.

我想提出一个进度栏上的操作栏,但设置

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

requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);  
setProgressBarIndeterminateVisibility(true);

的onCreate 方法产生一个中等大小的进度(48dip x 48dip)我猜。我想改变的进度栏的大小,但我无法找到如何做到这一点。你能帮助我吗?

on onCreate method produces a medium size progressBar (48dip x 48dip) I guess. I want to change the size of the progressBar but I cannot find how to do it. Can you help me please?

推荐答案

您需要创建自己的风格应用到动作条。有一个关于这个伟大的教程上的 Android开发者博客。的款式中间进度条,请尝试使用 indeterminateProgressStyle Widget.ProgressBar.Small 。这里有一个简单的例子。

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>