Android从操作栏中删除标题栏

时间:2014-09-25 12:03:52

标签: android android-fragments android-actionbar android-titlebar

我的应用中有一项活动,即使用带有操作栏的可滑动标签

例如: -

this tutorial

所以我的问题是在我的活动中添加操作栏并删除titlbar

similar question

3 个答案:

答案 0 :(得分:1)

在调用setContentView();

之前将其添加到您的活动中
this.requestWindowFeature(Window.FEATURE_ACTION_BAR | Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
             WindowManager.LayoutParams.FLAG_FULLSCREEN);

如果这不起作用,试试这个

//use this to disable the icon from ActionBar
    getActionBar().setDisplayShowHomeEnabled(false);

    //use this to disable the application name from ActionBar
    getActionBar().setDisplayShowTitleEnabled(false);

答案 1 :(得分:1)

我不确定你将什么作为标题栏,但是你可以通过将以下内容放入你的Android Manifest中来执行特定活动来删除你的标题栏。< / p>

android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen

答案 2 :(得分:0)

在添加内容之前,在oncreate()活动方法中使用此代码:

 getWindow().requestFeature(Window.FEATURE_NO_TITLE)