在 ActionBar 上样式不确定的进度条 [英] Styling indeterminate progressbar on ActionBar

查看:34
本文介绍了在 ActionBar 上样式不确定的进度条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在操作栏上放一个progressBar但是设置

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

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

on onCreate 方法产生一个中等大小的progressBar (48dip x 48dip) 我猜.我想更改 progressBar 的大小,但我找不到如何去做.你能帮我吗?

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?

推荐答案

您需要创建自己的样式以应用于 ActionBar.Android 开发者博客上有一个很棒的教程. 要设置中间进度条的样式,请尝试使用 indeterminateProgressStyleWidget.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>

这篇关于在 ActionBar 上样式不确定的进度条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆