android – How do I remove the title bar from my app?

android – How do I remove the title bar from my app?

Go to styles.xml and change .DarkActionBar for .NoActionBar

<style name=AppTheme parent=Theme.AppCompat.Light.DarkActionBar>
        <item name=colorPrimary>@color/colorPrimary</item>
        <item name=colorPrimaryDark>@color/colorPrimaryDark</item>
        <item name=colorAccent>@color/colorAccent</item>
</style>

becomes

<style name=AppTheme parent=Theme.AppCompat.Light.NoActionBar>
        <item name=colorPrimary>@color/colorPrimary</item>
        <item name=colorPrimaryDark>@color/colorPrimaryDark</item>
        <item name=colorAccent>@color/colorAccent</item>
</style>

if colors are irrelevant to your app, you can actually go for

<style name=AppTheme parent=Theme.AppCompat.Light.NoActionBar />

In the manifest file Change:

    [email protected]/AppTheme >
    [email protected]/Theme.AppCompat.NoActionBar

android – How do I remove the title bar from my app?

this.requestWindowFeature(Window.FEATURE_NO_TITLE);

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

otherwise it crashes

Leave a Reply

Your email address will not be published.