[The Android] control screen display (full screen, straight, transverse)

full screen


Sometimes the development of the game, there is a need or demand for the project full screen.


// 关闭APP标题bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);

// 关闭最上面的状态bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

//直行
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
//AndroidManifest.xml


//横行
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)
//AndroidManifest.xml


But remember, before you read this procedure again setContentView

Original: Large column  [Android]-screen display controls (full screen, straight, rampant)


Guess you like

Origin www.cnblogs.com/chinatrump/p/11490880.html