本文介绍了显示进度微调(刷新)在动作条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我使用的动作条。我想有一个刷新进度微调的标题栏,如果我将它设置为纺纱 - 否则隐藏它。这是可能的:

I'm using the ActionBar. I'd like to have a refresh progress spinner on the titlebar, if I set it to spinning - otherwise hide it. Is that possible?:

// My menu has a refresh item, but it shouldn't be visible on the
// actionbar unless it's spinning.
<menu xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:id="@+id/menu_refresh"
    android:title="@string/refresh"
    android:icon="@drawable/ic_action_refresh" />
</menu>

...

// When I need to show some work being done on my activity,
// can I somehow now make the spinner associated with the
// refresh item become visible on the action bar?
getActionBarHelper().setRefreshActionItemState(true);

我不希望它在动作条,除非它是进行中/旋转着。

I don't want it on the ActionBar unless it's "in progress" / spinning.

感谢

推荐答案

道歉没有code标签,可以从手机发布...

Apologies for no code tags, posting from phone...

这是从ActionbarSherlock(谷歌,如果你还没有遇到过,可以让动作条在pre蜂窝载体)

This is from ActionbarSherlock (Google that if you've not come across it, allows actionbar support in pre honeycomb)

在主要活动的onCreate

In onCreate of main activity

// This has to be called before setContentView and you must use the
// class in android.support.v4.view and NOT android.view

requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

要显示操作栏/隐藏进度。与actionbarsherlock请注意,你必须使用boolean.TRUE / ​​FALSE,不只是真/假.........

To show/hide progress in action bar. Notice with actionbarsherlock you must use boolean.TRUE/FALSE, not just true/false.........

if (getSupportLoaderManager().hasRunningLoaders()) {
   setProgressBarIndeterminateVisibility(Boolean.TRUE);
} else {
   setProgressBarIndeterminateVisibility(Boolean.FALSE);
}

这篇关于显示进度微调(刷新)在动作条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 18:35