requestWindowFeature(Window.FEATURE_NO_TITLE) ERROR

风格不统一 提交于 2019-12-12 05:49:43

问题


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?


回答1:


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);



来源:https://stackoverflow.com/questions/27891030/requestwindowfeaturewindow-feature-no-title-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!