requestWindowFeature(Window.FEATURE_NO_TITLE) ERROR

Pablo Reis picture Pablo Reis · Jan 11, 2015 · Viewed 9.3k times · Source

I'm having trouble putting my application fullscreen in Android Lollipop, my code :

public class AoA extends ActionBarActivity {

    protected void oncreate(Bundle savedInstanceState) {
        super.onCreate(SavedInstanceState);

        setupParameters();
    }

    public void setupParameters() {
        GameParameterSingleton.ORIENTATION = GameParameterSingleton.PORTRAIT;

        GameParameterSingleton.SCREEN_HEIGHT= getWindowManager().getDefaultDisplay().getHeight();
        GameParameterSingleton.SCREEN_WIDTH = getWindowManager().getDefaultDisplay().getWidth();

        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

        requestWindowFeature(Window.FEATURE_NO_TITLE);
    } 
}

The application works when I do not use fullscreen, Can anyone help me as I leave fulllscreen ? as I take the title of the application?

Answer

Saeed Masoumi picture Saeed Masoumi · Jan 11, 2015

It seems that in API 21

this.supportRequestWindowFeature(Window.FEATURE_NO_TITLE);

Doesn't work .

Try to Add this to your AndroidManifest.xml file

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

Or add this

this.getActionBar().hide();

in onCreate method after super.onCreate(savedInstanceState);