user1439582
user1439582

Reputation: 103

No Title Bar theme - The title bar is still appearing

I want "no title bar" in my android app.

I have changed AndroidManifest.xml from AppTheme.NoActionBar to Theme.NoTitleBar.Fullscreen .But the title bar is in grey color. I've not got any style for Theme.NoTitleBar.Fullscreen theme.

I also want to change navigation menu icon color. the menu icon is also not changing.

Upvotes: 0

Views: 1097

Answers (4)

Ace
Ace

Reputation: 2218

Not sure what you mean by:

I want "no title bar" in my android app.

and then:

I also want to change navigation menu icon color

Where is the menu icon supposed to show if not on the title bar?

Anyway, here is a backward compatible way to remove the title bar in your app:

  • Extend AppCompatActivity in your activities

  • Use Theme.AppCompat.NoActionBar as the parent theme for your (app/activity) theme

  • Inside this theme, set these flags

     <item name="windowActionBar">false</item>
     <item name="windowNoTitle">true</item>
    
  • Finally, apply the theme to your app or activities in AndroidManifest.xml with android:theme="@style/your_no_title_bar_theme"

Upvotes: 1

Mahesh Keshvala
Mahesh Keshvala

Reputation: 1355

Use the below code for the full-screen application:

    //Remove title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);

//Remove notification bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

//set content view AFTER ABOVE sequence (to avoid crash)
this.setContentView(R.layout.your_layout_name_here); 

and also put below lines into style file:

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

and into manifest apply this style to activity:

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

Upvotes: -1

Roy Parejo
Roy Parejo

Reputation: 341

Also look at the activity's theme

 <application
    android:name="android.support.multidex.MultiDexApplication"
    android:icon="@drawable/logo_icon"
    android:label="@string/app_name"
    android:theme="@style/Theme.AppCompat.Light.NoActionBar">
    <activity
        android:name=".MainActivity"
        android:theme="@style/SplashTheme">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>

Upvotes: 0

Kmelliti
Kmelliti

Reputation: 111

here the following code : ( if i got your question right )

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { Window w = getWindow(); w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); }

Upvotes: 0

Related Questions