【发布时间】:2012-05-31 18:45:07
【问题描述】:
我有一个使用 ActionBarSherlock 的 Activity。现在我想在该操作栏中显示一个不确定的进度,并按照 ActionBarSherlock 中的示例进行操作:
public class MainMenu extends SimpleWebActivity implements BackgroundBrowserReciever {
private Boolean windowFeatureCalled;
@Override
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
super.onCreate(savedInstanceState);
this.windowFeatureCalled = true;
setContentView(R.layout.main_menu);
....
}
SimpleWebActivity 是一个扩展了 SherlockActivity 的抽象类。
但是当我尝试加载该 Activity 时,我收到以下错误:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dalthed.tucan/com.dalthed.tucan.ui.MainMenu}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
为什么会出现这个错误,即使我在调用 setContentView 之前请求了 WindowFeature?
【问题讨论】:
标签: java android android-activity actionbarsherlock