1

I am creating a new button navigation activity in the option New> Activity> Button Navigation Activity. But I want to hide the header of the activity that always appears at the top left. How can I make this change? enter image description here

Ryan M
  • 18,333
  • 31
  • 67
  • 74
D.Sanxhez
  • 137
  • 8
  • I think you meant "bottom" navigation? – Martin Marconcini Jan 26 '21 at 12:17
  • 3
    Does this answer your question? [How to hide the title bar for an Activity in XML with existing custom theme](https://stackoverflow.com/questions/2591036/how-to-hide-the-title-bar-for-an-activity-in-xml-with-existing-custom-theme) – tomerpacific Jan 26 '21 at 12:20

3 Answers3

1

If you have a fragment and the action bar is the default you can call this with empty String

//Kotlin
requireActivity().actionBar.title = ""
//Java
requireActivity().getActionBar.setTitle("")

If its Activity

//Kotlin
actionBar.title = ""
//Java
getActionBar.setTitle("")

If you have your own toolbar you can set the title with an empty String.

N/B you can set null or empty string. Should work fine.

Assuming that you want to hide the ActionBar you can refer to this

ronnieotieno
  • 134
  • 2
  • 11
1

Try this

this.getSupportActionBar().hide();

To hide entire ActionBar

Or you can try this ON YOUR activity

this.requestWindowFeature(Window.FEATURE_NO_TITLE);

It will hide your text only

Shay Kin
  • 2,539
  • 3
  • 15
  • 22
0

Extend your app theme from NoActionBar theme like the following

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

Else if you want to hide title bar not in whole app, but in specific Activity then create a NoActionBar theme separately

<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

and then in manifest

<activity android:name=".yourpackage.subpack.YourActivity" android:theme="@style/AppTheme.NoActionBar" />

rahat
  • 1,840
  • 11
  • 24