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

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

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

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

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

 

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

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

 

而相關語法參數如下

 

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" 不顯示應用程式標題欄,並全螢幕

 

 


發表自: 九五二七九五二七
愛漫畫愛遊戲愛上網愛星爺,小時摸到阿羅士與AppleII後註定宅一輩子,從紅白機玩到PS4,從386打到Xeon,沒日沒夜的打電動;待過所有宅產業,從光華混到NOVA,從遊戲滾到動漫,從攝影器材爬到網路電信,喜愛學習多於睡覺,無時無刻散發一股宅味,但號稱長的像梁朝偉XD

覺得讚想推薦或分享嗎?