Intermediate Progress doesn't work with ActionBarSherlock running on Gingerbread

前端 未结 4 1714
长发绾君心
长发绾君心 2021-01-18 19:33

I setup ActionBarSherlock with my app, and I\'m trying to use the Intermediate Progress, I\'m using this:

    requestWindowFeature(Window.FEATURE_IN         


        
4条回答
  •  被撕碎了的回忆
    2021-01-18 20:21

    I just had the same problem. Jake's solution above did not fix it for me - the method is undefined.

    I found a working solution posted by Jake on the bug list for ActionBarSherlock here:

    • Action Bar Indeterminate Progress Bar Not Disappearing

    See Jake's response to the poster - the trick is to call getSupportActionBar() first, to "trigger creation of the views".

    So my onCreate() method is:

    protected void onCreate(Bundle arg0)
    {
        super.onCreate(arg0);
    
        // allow window to show progress spinner in the action bar
        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
        getSupportActionBar();
        setSupportProgressBarIndeterminateVisibility(false); 
    }
    

    Update based on comment from Laux:

    Make sure your imports reflect com.actionbarsherlock.view.Window.FEATURE_INDETERMINATE_PROGRESS for this to work.

    Here is part of my import block from an app that uses this pattern:

    import com.actionbarsherlock.app.ActionBar;
    import com.actionbarsherlock.app.SherlockActivity;
    import com.actionbarsherlock.view.ActionProvider;
    import com.actionbarsherlock.view.Menu;
    import com.actionbarsherlock.view.MenuItem;
    import com.actionbarsherlock.view.Window;
    import com.actionbarsherlock.widget.ShareActionProvider;
    

    This is a very good thing to remember when working with ABS - many of your normal Android imports should be updated to refer to ABS instead.

    It may be a good idea to revisit your import block, or possibly remove it entirely and let Eclipse rebuild it for you (CTRL-SHIFT-O) to which point Eclipse will prompt you for each import that ABS redeclares.

    This was also explained by Glebbb in his answer.

提交回复
热议问题