3

我正在尝试在其中显示不确定的进度条,SherlockFragmentActivity 但我的代码仅显示 ActionBar 而没有ProgreessBar其中

这是我在 Android 4.1.1 中运行的代码

import com.actionbarsherlock.view.Window;
....
....
public class SowahActivity extends SherlockFragmentActivity{
....
...
...
protected void onCreate(Bundle savedInstanceState) {

        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
        setSupportProgressBarIndeterminateVisibility(true);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.my_list_view);
}
...
...
}

是什么让进度对话框没有出现在操作栏中

4

2 回答 2

5

您正在尝试在Activity创建之前设置进度条。尝试像这样重新排序:

requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
super.onCreate(savedInstanceState);
setContentView(R.layout.my_list_view);
setSupportProgressBarIndeterminateVisibility(true);    
于 2012-08-20T01:18:35.403 回答
1
 //This has to be called before setContentView and you must use the
        //class in com.actionbarsherlock.view and NOT android.view
        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
于 2012-09-17T03:48:06.277 回答