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?
-
I think you meant "bottom" navigation? – Martin Marconcini Jan 26 '21 at 12:17
-
3Does 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 Answers
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

- 134
- 2
- 11
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

- 2,539
- 3
- 15
- 22

- 135
- 5
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" />

- 1,840
- 11
- 24