我正在尝试在SherlockFragmentActivity
中显示不确定的进度条
但我的代码只显示没有ProgreessBar
的ActionBar
以下是我在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);
}
...
...
}
是什么让进度对话框没有出现在操作栏
中答案 0 :(得分:5)
您正在尝试在创建Activity
之前设置进度条。请尝试重新排序:
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
super.onCreate(savedInstanceState);
setContentView(R.layout.my_list_view);
setSupportProgressBarIndeterminateVisibility(true);
答案 1 :(得分: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);