如何禁用窗口的标题在FragmentActivity? [英] How to disable the window's title in a FragmentActivity?
问题描述
在我的活动,扩展了FragmentActivity类的,我不能禁止使用 this.requestWindowFeature(Window.FEATURE_NO_TITLE)称号;
。它给出了一个ANR。
我如何禁用FragmentActivity的标题?
这是该活动的启动的部分code:
公共类NewOrderActivity扩展FragmentActivity实现TabListener {
@覆盖
公共无效的onCreate(包savedInstanceState){
super.onCreate(savedInstanceState);
。this.getWindow()setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
...
}
}
编辑:答:
好吧,我发现,在已经一个动作条在其声明的活动,标题是操作栏的一部分,而不是Windows本身。
所以在我的code我这样做是为了摆脱窗口(或者不如说,ActionBar的)标题:
...
...
最后的动作条动作条= getActionBar();
actionBar.setDisplayOptions(Window.FEATURE_NO_TITLE);
...
...
你应该使用: -
getSupportActionBar()setDisplayShowTitleEnabled(假);
getSupportActionBar()setDisplayShowHomeEnabled(假);
In my activity that extends the FragmentActivity class, I can't disable the title using this.requestWindowFeature(Window.FEATURE_NO_TITLE);
. It gives an ANR.
How can I disable a FragmentActivity's title?
This is the partial code of the activity's start:
public class NewOrderActivity extends FragmentActivity implements TabListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
...
}
}
EDIT: ANSWER:
Okay, I found out that in an activity that has an ActionBar declared in it, the title is a part of the Action Bar not the windows itself.
so in my code I did this to get rid of the window's ( or better to say, ActionBar's ) title:
...
...
final ActionBar actionBar = getActionBar();
actionBar.setDisplayOptions(Window.FEATURE_NO_TITLE);
...
...
you should use:-
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayShowHomeEnabled(false);
这篇关于如何禁用窗口的标题在FragmentActivity?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!