'How to remove Header title in bottom nav bar - Android Studio

My objective is removing the orange bar thar has the label "App name".

Currently I have a top_app_bar and bottom_nav_bar. As far as I know the orange bar is generated by the bottom nav bar.

App design

This is the bottom nav bar implementation in the activity_main.

Activity_main.xml bottom_nav_bar implementation

This is the top app bar implementation in the activity_main. enter image description here



Solution 1:[1]

The top bar is called ActionBar. The ActionBar is a part of the default layout of the theme you are using.

Method 1:

You can hide the ActionBar by creating a NO ActionBar Style in the Style.xml and setting the class's style to that.

In Style.xml

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

Then In the Manifest set the theme for the class to this NoActionBar Style.

In AndroidManifest.xml

 <activity
            android:name=".MainActivity"
            android:theme="@style/AppTheme.NoActionBar" />

Method 2

Simply add a default NoActionBar Style in Manifest

<activity android:name=".MainActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />

Method 3

You can do it programmatically

Java

if (getSupportActionBar() != null) {
    getSupportActionBar().hide();
}

Kotlin

supportActionBar?.hide()

Solution 2:[2]

try

private void hide() {
    // Hide UI first
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.hide();
    }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 K M Rejowan Ahmmed
Solution 2 Žiga Poto?nik