How do I remove the title bar in android studio?

后端 未结 24 1180
轮回少年
轮回少年 2020-12-04 08:03

In my app there is this title bar at the top where the overflow menu would be, but I don\'t need settings and only have one screen. When I change the theme like described in

相关标签:
24条回答
  • 2020-12-04 08:51

    Just use setTitle(null) above

    toolbar = (Toolbar) findViewById(R.id.toolbar);
            setSupportActionBar(toolbar);
    

    The title will disappear then you can use the logo of your choice.....

    0 讨论(0)
  • 2020-12-04 08:52

    The easiest way: Just double click on this button and choose "NoTitleBar" ;)

    Click here to see where it is :)

    0 讨论(0)
  • 2020-12-04 08:54

    try: toolbar.setTitle(" ");

    @Override
    protected void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = findViewById(R.id.toolbar);
        toolbar.setTitle("");
        setSupportActionBar(toolbar);
    }
    
    0 讨论(0)
  • 2020-12-04 08:55
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    

    works in onCreate() when put before setContentView() is invoked.

    otherwise it crashes

    0 讨论(0)
  • 2020-12-04 08:55

    delete the following from activity_main.xml

    <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay"/>
    

    contact me for more help

    0 讨论(0)
  • 2020-12-04 08:58

    do this in you manifest file:

    <application 
        android:icon="@drawable/icon" 
        android:label="@string/app_name" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
    
    0 讨论(0)
提交回复
热议问题