在android的sdk 安裝目錄data\res\values\themes.xml 裏系統定義好的主題,可以直接使用,在AndroidManifest.xml中定義。
如果整個工程用一個主題就在<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.Wallpaper" > application 標籤中定義
。如果在單個activety中用不同主題, <activity android:name=".secondActive" android:label="第二頁" android:theme="@android:style/Theme.Black" >
如果不小心刪除了工程文件可以這樣找回來 在工程目錄,右鍵,有個Restore from Local History,選擇要回復的文件。
下面是從網上找到的主題,可以自己去themes.xml 中看。下面的前三個之外直接複製就會出錯。@是說明系統已經定義過的,@android:style/ 是必須帶上的。
?android:theme="@android:style/Theme.Dialog" 將一個Activity顯示爲能話框模式
?android:theme="@android:style/Theme.NoTitleBar" 不顯示應用程序標題欄
?android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 不顯示應用程序標題欄,並全屏
?android:theme="Theme.Light" 背景爲白色
?android:theme="Theme.Light.NoTitleBar" 白色背景並無標題欄
?android:theme="Theme.Light.NoTitleBar.Fullscreen" 白色背景,無標題欄,全屏
?android:theme="Theme.Black" 背景黑色
?android:theme="Theme.Black.NoTitleBar" 黑色背景並無標題欄
?android:theme="Theme.Black.NoTitleBar.Fullscreen" 黑色背景,無標題欄,全屏
?android:theme="Theme.Wallpaper" 用系統桌面爲應用程序背景
?android:theme="Theme.Wallpaper.NoTitleBar" 用系統桌面爲應用程序背景,且無標題欄
?android:theme="Theme.Wallpaper.NoTitleBar.Fullscreen" 用系統桌面爲應用程序背景,無標題欄,全屏
?android:theme="Translucent"
?android:theme="Theme.Translucent.NoTitleBar"
?android:theme="Theme.Translucent.NoTitleBar.Fullscreen"
?android:theme="Theme.Panel"
?android:theme="Theme.Light.Panel"
?android:theme="@android:style/Theme.NoTitleBar" 不顯示應用程序標題欄
?android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 不顯示應用程序標題欄,並全屏
?android:theme="Theme.Light" 背景爲白色
?android:theme="Theme.Light.NoTitleBar" 白色背景並無標題欄
?android:theme="Theme.Light.NoTitleBar.Fullscreen" 白色背景,無標題欄,全屏
?android:theme="Theme.Black" 背景黑色
?android:theme="Theme.Black.NoTitleBar" 黑色背景並無標題欄
?android:theme="Theme.Black.NoTitleBar.Fullscreen" 黑色背景,無標題欄,全屏
?android:theme="Theme.Wallpaper" 用系統桌面爲應用程序背景
?android:theme="Theme.Wallpaper.NoTitleBar" 用系統桌面爲應用程序背景,且無標題欄
?android:theme="Theme.Wallpaper.NoTitleBar.Fullscreen" 用系統桌面爲應用程序背景,無標題欄,全屏
?android:theme="Translucent"
?android:theme="Theme.Translucent.NoTitleBar"
?android:theme="Theme.Translucent.NoTitleBar.Fullscreen"
?android:theme="Theme.Panel"
?android:theme="Theme.Light.Panel"