天天看點

Android Activity全屏和設定背景色

我們都知道在Android中某些功能的實作往往有兩種方法:一種是在xml檔案中設定相應屬性,另一種是用代碼實作。同樣Android實作全屏顯示也可以通過這兩種方法實作:

1、在AndroidManifest.xml的配置檔案裡面的<activity>标簽添加屬性:

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

2、在Activity的onCreate()方法中的super()和setContentView()兩個方法之間加入下面兩條語句:

this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标題欄

this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//去掉資訊欄

上述轉自:http://www.cnblogs.com/wader2011/archive/2011/11/19/2255045.html

修改為黑底白字

修改AndroidManifest.xml

把android:theme="@style/AppTheme" 修改為

android:theme="@android:style/Theme.Black“

修改為白底黑字

android:theme="@android:style/Theme.Light“

上述轉自:http://www.cnblogs.com/henryxu/archive/2013/04/16/3024630.html