Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

requestWindowFeature(Window.FEATURE_NO_TITLE); not working

Tags:

java

android

i have referred many questions....but not any answer working in my case....plz help me.....

package com.example.owner.bikeguard;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

public class LoginActivity extends AppCompatActivity
{

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_login);

    }
}
like image 743
Bodakiya Vishal Avatar asked Oct 15 '25 23:10

Bodakiya Vishal


2 Answers

protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  getSupportActionBar().hide();
  setContentView(R.layout.activity_main);
}

this will hide the action bar completely

like image 151
Subodh Kumar Avatar answered Oct 17 '25 13:10

Subodh Kumar


i've an easy way to do this. You can simple achieve NO_TITLE for whole application by setting it to the AppTheme

<style name="AppTheme" parent="Theme.AppCompat.DayNight">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>
    </style>

these tags for Actionbar

 <item name="windowActionBar">false</item>

these is for No title

<item name="windowNoTitle">true</item>

these is for FullScreen

<item name="android:windowFullscreen">true</item>
like image 31
Shailesh Bandil Avatar answered Oct 17 '25 12:10

Shailesh Bandil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!