只需添加这个以使屏幕全屏this.setTheme(android.R.style.Theme_NoTitleBar_Fullscreen);
之前super.onCreate(savedInstanceState);
或者
添加this.requestWindowFeature(Window.FEATURE_NO_TITLE);
和
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)
之前setContentView
例如:
@Override
public void onCreate(Bundle savedInstanceState){
/**sets Theme and Style (must be set BEFORE super.onCreate)*/
this.setTheme(android.R.style.Theme_NoTitleBar_Fullscreen);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
或者
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
/**Changes Window. Removes title and/or notification bar (must be set BEFORE setContentView)*/
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
(或者你可以像 homer_simpson 所说的那样通过 Manifest 来做到这一点。)