我尝试在setContent方法之前和之后添加,但仍然面临“在添加内容之前必须调用android.util.AndroidRuntimeException: requestFeature()”的问题
public void onNewIntent(Intent intent){
final boolean customTitleSupported =
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
super.onNewIntent(intent);
session = new SessionManagement(getApplicationContext());
if(customTitleSupported){
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.item);
}
setContentView(R.layout.itemlist);
setIntent(intent);发布于 2015-08-07 20:09:16
在调用setContentView()之前,应该先调用requestWindowFeature(Window.FEATURE_CUSTOM_TITLE)。一个不错的位置应该是在Activity中的onCreate方法中的super.onCreate()之前。
https://stackoverflow.com/questions/31877332
复制相似问题