Showing indeterminate progress in Sherlock Action Bar

筅森魡賤 提交于 2019-12-21 06:56:02

问题


i`m trying to show indeterminate progress bar in ABS v. 4.0.2 by following code

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    setContentView(R.layout.main);

    getSherlock().setProgressBarIndeterminateVisibility(true);
}

on ICS virtual device it works fine, but progress do not shows in device with Android 2.1. what i`m doing wrong?


回答1:


Make sure you import com.actionbarsherlock.view.Window, not android.view.Window.




回答2:


Try setSupportProgressBarIndeterminateVisibility(boolean) to get backward compatibility.




回答3:


do this:

requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.section_one1);
setSupportProgressBarIndeterminateVisibility(false);  

on anything clickable like starting an activity via intent or adapters or whatever show your progressbar on click

setSupportProgressBarIndeterminateVisibility(true);

but using this method when the user goes back to the activity the progress dialog will be visible still. There are many ways to stop it but the easiest one is just to use

   @Override
    public void onBackPressed()
    { 
    NavUtils.navigateUpFromSameTask(this);
        super.onBackPressed();
    }


来源:https://stackoverflow.com/questions/10542103/showing-indeterminate-progress-in-sherlock-action-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!