九五二七宅在家
發文於
無分類

Android AppTheme 系統預設樣式android:Theme語法整理

作者

在使用新版Eclipse開發Android程式時

創建Android Project後會多了res/values/styles.xml的樣式檔案

事實上這是讓Android讀取的預設的樣式定義檔

例如要讓整個程式的基本樣式為亮色系或暗色系~

或者要隱藏標題全螢幕等等, 皆可以在這個檔案上進行修改...

 

在/res/values/目錄下, 預設的styles.xml內容

<resources>
<style name="AppTheme" parent="android:Theme.Light" />
</resources>

 

而相關語法參數如下

--summary--

 

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.Dialog"   將一個Activity顯示為能話框模式

android:theme="@android:style/Theme.NoTitleBar" 不顯示應用程式標題欄

android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 不顯示應用程式標題欄,並全螢幕