第一:在程序代碼中實現
this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉標題欄
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//去掉信息欄
注意:這兩行代碼要寫在頁面顯示之前,即setContentView(R.layout.XXX)之前
第二:在AndroidManifest.xml配置文件中實現標籤android:theme
<activity android:name="Activity1"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"></activity>
注意:如果不需要全屏,只需要寫成android:theme="@android:style/Theme.NoTitleBar即可