XML 文件是由一些代碼構成的,所以我們只要大概的明白了這些代碼的含義,就可以隨心所欲的 DIY 自己的主題了!
首先我們有必要了解 XML 的一些基本規則:
1. XML 文檔必須包含在一個單一元素中;
2. XML 元素不能重疊,必須正確的嵌套;
3. 不能省去任何結束標記 , 或者說標記必須成對;
4. XML 元素是區分大小寫的,也就是大小寫敏感;
5. XML 文檔中的屬性必須有值,那些值必須用引號括起,可以使用單引號,也可以使用雙引號,但要始終保持一致;
6. 如果文檔包含 XML 聲明,則它一定是第一個出現的東西;
7. XML 注釋和 HTML 注釋的形式及用法相同,如:
<!-- 拆成多個插件塊是考慮到各部分的更新頻率不一樣,拆開后更省電 -->
就表示一個注釋。 ]
即: <!-- 中間的文字說明就為注釋的內容 -->
下面我們先來看一個簡單的主題的 XML 源文件,即 simple.home.xml ,首先當然要將智能手機與電腦聯機,然后將這個文件從\ Application Data \ Home 目錄下復制到電腦上的任意位置,再在這個文件上單擊右鍵,選擇用“記事本”方式打開它。
當然如果你經常要編輯這些 XML 主題源文件的話建議你設置“始終用記事本這個程序打開這類文件”,如下圖所示。
用記事本打開 simple.home.xml 顯示如下,我一一來向大家介紹這些代碼的含義:
最搞笑是將 <text><carrier/></text>
改成 : <text lang="0x0804"> 桃江移不動~聯不通 </text>
這樣就會在桌面上顯示桃江移不動~聯不通 , 但是在撥打電話時還是顯示你默認的運營商的名字 , 如下圖 :
也就是說如果想讓手機的桌面和撥打電話窗口都顯示其他的名字 , 必須改注冊表 , 如果只是想桌面上換一下就用上面的方法可以非常容易的實現了。
附在注冊表中修改中國移動為其他名稱的方法:
打開注注冊表,找到 hkey_local_matchine \ software \ microsoft \ ril \ Operatornames 下建一個 string , value name 為 46000,value data 為你要顯示的字符串如 " 中國移動3G網絡 " 。
我最喜歡的是 http://www.orchid-soft.com/ 網站上的 Orchid 主題,因為它開放了源代碼,我們可以任意的修改和編輯的,下面就來介紹一下這個主題的源文件。我們先必須 gc http://www.orchid-soft.com/html/zuopinxiazai/index.html 下載一個 Orchid 主題的 CAB 格降陌滄拔募?,注意版本訛a芏嘀鄭葑約旱陌醚≡癜桑?J
有一種效果如下:
一種效果如下:
還有一種設置非常方便的:
安裝后以后只要任意地再選一個主題,它就會自動加上上面的導航欄——“最近,開始,游戲,附件,插件”,當然還可以分組設置……
任意打開一個 Orchid_full.home.xml 源文件后,如下圖:
<plugin clsid=" ………… > 與 </plugin> 之間就對應一個插件,要知道這個插件是什么意思,關鍵的就看 name= ?,如 iconbar 就是電池,信號圖標的狀態欄; carrier ——移動運營商…………
一、以下為手機桌面的最上面一行、顯示電池、信號圖標的狀態欄的代碼,一般是源文件里的第一個插件!當然你也可以刪除,或者復制這段代碼到其他地方。
<plugin clsid="{837FC251-FE69-43ad-84E0-EBCEDEBA0884}" name="iconbar" height="27">
<iconbar fgcolor="COLOR_TRAYTEXT"/>
<background gradient="title" bgcolor="COLOR_TRAYGRADLEFT" b-border-color="COLOR_WINDOWFRAME" /> </plugin>
二、以下為顯示移動運營商的代碼:
<plugin clsid="{E09043DF-510E-4841-B652-388316977A7A}" name="carrier" height="27">
<allowselection/>
<background>
<format state="selected" bgcolor="COLOR_HOMEHIGHLIGHT"/>
</background>
<label font-weight="bold">
<text><carrier/></text>
</label>
</plugin>
三、以下為顯示時間的代碼 :
<plugin clsid="{AFC6BAE1-194B-487c-856C-70C540EFD189}" name="calender">
<background padding-bottom="0" b-border-width="0"/>
<label align="left" valign="top" font-size="44" font-width="12" cleartype="true" shadow="true" color="#36FF1A">
<format state="selected" bgcolor="transparent" font-underline="true"/>
<shortcut lang="0x0804" cmd="ShowInfo" title=" 系統信息 "/>
<text><hour/>:<minute len="2" leadzero="true"/>:<second len="2"/></text>
</label>
</plugin>
這里要重點說明一下 :
這個插件的關鍵語句顯然是 <text><hour/>:<minute len="2" leadzero="true"/>:<second len="2"/></text> ,其中 <second len="2"/> 是我加上去的,它的作用就是顯示秒鐘,不過聽說這樣會比較耗電! len="2" 如果改成 len="1" ,那么就會由 8:08:08 變成 8: 8: 8 ,就是位數的意思。當然如果秒數有兩位,比如說是 18 秒, len="1" 也會顯示成 18 的。
: 可以改成其他的字符,如 * , # ,時,分,秒??磮D:
上面的 <label align="left" valign="top" font-size="44" font-width="12" cleartype="true" shadow="true" color="#36FF1A"> 這一段代碼顯然是控制時鐘,分鐘,秒鐘的字體大小 font-size 、寬度 font-width 、陰影 shadow 、顏色 color 的。這個可以任意的設置,自己多改幾次對照一下就會出效果的!
關于顏色的代碼,可以訪問下面這個網頁,非常的棒,偶一直在用的,當然將這個網頁保存了: http://www.cclw.net/resources/CheckColor/CheckColor.htm
四、以下為通話中的桌面顯示代碼:
<plugin clsid="{37391041-C324-4725-BEE1-3232ED3539CA}" name="callPRog" height="48">
<background>
<format state="selected" bgcolor="COLOR_HOMEHIGHLIGHT"/>
</background>
<format state="nocall" visible="false"/>
<label>
<text lang="0x0409">Call in progress:</text>
<text lang="0x0404"> 通話中 :</text>
<text lang="0x0804"> 嘻嘻,廣大 Lqem ,你的手機正在通話中哦 ...</text>
</label>
<label y="23">
<text><progress/></text>
</label>
</plugin>
顯然, <format state="nocall" visible="false"/> 這段代碼的意思就是當不是在通話中時,這個提示就不會出現的.
五、以下為未接電話的代碼:
<plugin clsid="{0BA8ABB8-1F1D-417f-88C6-DA8530E2E7A6}" name="missedcalls" height="24">
<background>
<format state="selected" bgcolor="COLOR_HOMEHIGHLIGHT"/>
</background>
<format state="nocall" visible="false"/>
<label h="22">
<text lang="0x0409">Missed calls: <calls/></text>
<text lang="0x0404"> 未接來電 : <calls/></text>
<text lang="0x0804"> 嘻嘻,廣大 Lqem ,你有未接電話哦 : <calls/></text>
</label>
</plugin>
六、以下為全天事件的代碼:
<plugin clsid="{2FFD93B3-0FF0-4228-A6D6-D2DF177D7D92}" name="alldayevent" height="24">
<background>
<format state="selected" bgcolor="COLOR_HOMEHIGHLIGHT"/>
</background>
<format state="noevent" visible="false"/>
<label h="22">
<text><subject/></text>
</label>
</plugin>
同樣的, <format state="noevent" visible="false"/> 這段代碼表示,當沒有設置全天事件時,它不會顯示 ~
七、以下代碼表示桌面上被選擇文字的顏色:
<plugin clsid="{4e822425-a00f-497c-80ff-1c554665a369}" name="cooltext" height="20">
<scrolltext textsource="cellbroadcast"/>
<background>
<format state="selected" bgcolor="COLOR_HOMEHIGHLIGHT"/>
</background>
</plugin>
八、以下代碼為 Orchid 主題的精華所在,本人覺得非常的實用,不過它本身的排版不是很合理,
字體較小,顏色偶也不滿意,所以就這些代碼改得面目全非后,終于弄好了,即將關鍵性的文字放到了左邊 , 效果如下圖 :
代碼如下 :
<plugin clsid="{AFC6BAE1-194B-487c-856C-70C540EFD189}" name="info">
<background padding-top="0"/>
<label align="left" font-size="24" font-width="5" fgcolor="#FFFFF0"
cleartype="true">
<text lang="0x0804"><battery/>% ★ <storageload op="x-" opnum="100"/>%</text>
<text lang="0x0404"> 電池 :<battery/>%<temperature invalid="0" ls=" "
rs=" ℃ "/><space/> 信號 :<signal/>%<space/> 記憶 :<memoryload op="x-" opnum="100"/>%<space/> 存
儲 :<storageload op="x-" opnum="100"/>%</text>
</label>
<label y="24" align="left" font-size="21" font-width="5" color="#FF27FF">
<text lang="0x0804"><month/> 月 <day/> 日 </text>
<text lang="0x0404"><year/>-<month/>-<day/><space/> 星期
<cweek/><space/><xingzuo/></text>
</label>
<label y="45" align="left" font-size="21" font-width="6" color="#56FFFF">
<text lang="0x0804"> 星期 <cweek/></text>
<text lang="0x0404"><year/>-<month/>-<day/><space/> 星期
<cweek/><space/><xingzuo/></text>
</label>
<label y="66" align="left" font-size="21" font-width="4" color="#118FFF">
<text lang="0x0804"><lmonth/><lday/><jieqi ls=" "/></text>
<text lang="0x0404"><shengxiao/> 年 <space/><lmonth/><space/><lday/><jieqi
ls=" "/></text>
</label>
</plugin>
唉 , 這里要說明的東東太多了 , 我只簡單的介紹一下 , 自己慢慢去 DIY 吧 ,
<label y="45" align="left" font-size="21" font-width="6" color="#56FFFF">
顯然是控制字體的的垂直位置 y="45" ,水平位置 align, 大小 font-size, 寬度 font-width, 顏色 fgcolor 的 .
<battery/>% ★ <storageload op="x-" opnum="100"/>% 表示手機的剩余電量和剩余存儲量 .
<text lang="0x0804"><year/> 年 <month/> 月 <day/> 日 </text> 顯然表示年月日 , 其中年月日可以用其他字符表示 , 如-,/……●■▲,反正只要自己明白就行。
<text lang="0x0804"> 星期 <cweek/><space/><xingzuo/></text> 表示星期和星座,其中星期可以改成“周”。
<text lang="0x0804"><shengxiao/> 年 <space/><lmonth/><space/><lday/><jieqi ls=" "/></text>
分別表示生肖(如豬年),農歷(如十一月大十九),節氣。另外 lmonth 標簽可以改成 lleapmonth, lshortmonth, lmonthlen 中的任何一個~效果我懶得說了,自己去改。
九、以下為情景模式的代碼:
<plugin clsid="{95976968-45D5-40c9-9779-2B859B1C2FEC}" name="profile" height="24">
<label>
<text lang="0x0409">Profile: <profile/></text>
<text lang="0x0404"> 操作模式 : <profile/></text>
<text lang="0x0804"> 多普達 596 ,這里的文字可以任意修改 : <profile/></text>
</label>
</plugin>
十、以下為日程提醒的代碼:
<plugin clsid="{865A354A-4A96-4687-B001-C155DC0DBE76}" name="calendar" height="24">
<background>
<format state="selected" bgcolor="COLOR_HOMEHIGHLIGHT"/>
</background>
<label h="22">
<text><subject/> ◆ <time/> <location/></text>
</label>
</plugin>
如果將 <background><format state="selected" bgcolor="COLOR_HOMEHIGHLIGHT"/>
</background> 這一段去掉的話,選中日程提醒就不會有背景了!其他的類似!
這里本身顯示兩行的(即一行日程提醒的內容,一行是日程提醒的時間),我修改了一下,變成一行了 ~
十一、以下為 Orchid Home 快捷方式插件代碼(顯然我作了改動 ^_^ ):
<plugin clsid="{AFC6BAE1-194B-487c-856C-70C540EFD189}" name="header" b-border-width="0" padding-bottom="0">
<shortcutbar icon-spacing="3" mode="title">
<format state="selected" bgcolor="transparent" fgcolor="#FC6450"/>
<shortcut lang="0x0804" title="EM" desc=" 全部 " relbar="list" relgroup="0"/>
<shortcut lang="0x0804" title=" 地球 " relbar="list" relgroup="1"/>
<shortcut lang="0x0804" title=" 中國 " relbar="list" relgroup="2"/>
<shortcut lang="0x0804" title=" 湖南 " relbar="list" relgroup="3"/>
<shortcut lang="0x0804" title=" 益陽 " relbar="list" relgroup="4"/>
<shortcut lang="0x0804" title=" 桃江 " relbar="list" relgroup="5"/>
<shortcut lang="0x0804" title=" 鲊埠 " relbar="list" relgroup="6"/>
<shortcut lang="0x0404" title=" 全 " desc=" 全部 " relbar="list" relgroup="0"/>
<shortcut lang="0x0404" title=" 系統 " relbar="list" relgroup="1"/>
<shortcut lang="0x0404" title=" 工具 " relbar="list" relgroup="2"/>
<shortcut lang="0x0404" title=" 程式 " relbar="list" relgroup="3"/>
<shortcut lang="0x0404" title=" 媒體 " relbar="list" relgroup="4"/>
<shortcut lang="0x0404" title=" 遊戲 " relbar="list" relgroup="5"/>
<shortcut lang="0x0404" title=" 網路 " relbar="list" relgroup="6"/>
</shortcutbar>
</plugin>
十二、以下為快捷方式文字說明的代碼:
<plugin clsid="{AFC6BAE1-194B-487c-856C-70C540EFD189}" name="shortcut" padding-top="1" padding-bottom="0">
<shortcutbar icon-spacing="3" icon-size="small" mode="icon" name="list" grouped="true" autosort="true" last
<format state="selected" bgcolor="COLOR_HOMEHIGHLIGHT"/>
<!-- 快捷組支持 shortcut 直接指定文件和 shortcutdir 指定目錄下所有文件兩種方式,
為了方便定制,這里使用 shortcutdir 來指定快捷方式目錄,兩種方式可以混合使用。
如果需要指定快捷方式順序或自己組織分組,可參考下面 shortcut 標簽的例子。
<shortcut title=" 媒體播放器 " target="WMPlayer.lnk" group="4"/>
<shortcut title="Active 同步 " target="repllog.exe" args="/remote" group="6"/>
<shortcut target="InstMsgr.exe" group="6"/>
<shortcut target="iexplore.exe" group="6"/>
-->
<shortcutdir lang="0x0804" dir="/windows/Start Menu" subdir="false" group="1"/>
<shortcutdir lang="0x0804" dir="/windows/Start Menu/ 系統 " subdir="true" group="1"/>
<shortcutdir lang="0x0804" dir="/windows/Start Menu/ 工具 " subdir="true" group="2"/>
<shortcutdir lang="0x0804" dir="/windows/Start Menu/accessories" subdir="true" group="2"/>
<shortcutdir lang="0x0804" dir="/windows/Start Menu/ 程序 " subdir="true" group="3"/>
<shortcutdir lang="0x0804" dir="/windows/Start Menu/ 媒體 " subdir="true" group="4"/>
<shortcutdir lang="0x0804" dir="/windows/Start Menu/Games" subdir="true" group="5"/>
<shortcutdir lang="0x0804" dir="/windows/Start Menu/ 網絡 " subdir="true" group="6"/>
<shortcutdir lang="0x0404" dir="/windows/Start Menu" subdir="false" group="1"/>
<shortcutdir lang="0x0404" dir="/windows/Start Menu/ 系統 " subdir="true" group="1"/>
<shortcutdir lang="0x0404" dir="/windows/Start Menu/ 工具 " subdir="true" group="2"/>
<shortcutdir lang="0x0404" dir="/windows/Start Menu/Accessories" subdir="true" group="2"/>
<shortcutdir lang="0x0404" dir="/windows/Start Menu/ 程式 " subdir="true" group="3"/>
<shortcutdir lang="0x0404" dir="/windows/Start Menu/ 媒體 " subdir="true" group="4"/>
<shortcutdir lang="0x0404" dir="/windows/Start Menu/Games" subdir="true" group="5"/>
<shortcutdir lang="0x0404" dir="/windows/Start Menu/ 網路 " subdir="true" group="6"/>
</shortcutbar>
</plugin>
十三、以下為短信、彩信、電子郵件的代碼:
<plugin clsid="{8486CC1E-025B-4888-9C76-048DF7C1787D}" name="msgcount2" height="25" autoheight="false">
<background>
<format state="selected" bgcolor="COLOR_HOMEHIGHLIGHT"/>
</background>
<mail account="sms"/>
</plugin>
<plugin clsid="{8486CC1E-025B-4888-9C76-048DF7C1787D}" name="msgcount2" height="25" autoheight="false">
<background>
<format state="selected" bgcolor="COLOR_HOMEHIGHLIGHT"/>
</background>
<mail account="activesync"/>
</plugin>
<plugin clsid="{8486CC1E-025B-4888-9C76-048DF7C1787D}" name="msgcount2" height="25" autoheight="true">
<text padding-bottom="5"/>
<background>
<format state="selected" bgcolor="COLOR_HOMEHIGHLIGHT"/>
</background>
<mail account="others"/>
</plugin>
十四、以下為 Orchid Home 的節日插件:
<plugin clsid="{AFC6BAE1-194B-487c-856C-70C540EFD189}" name="holiday">
<background padding-top="0" padding-bottom="0" b-border-width="0" />
<label align="right" ellipsis="true">
<text lang="0x0804"><holiday ls=" 今日 "/><holiday sday="1" ls=" 明日 "/><holiday sday="2" eday="6" incdate="true" ls=" "/></text>
<text lang="0x0404"><holiday ls=" 今日 "/><holiday sday="1" ls=" 明日 "/><holiday sday="2" eday="6" incdate="true" ls=" "/></text>
</label>
</plugin>
十五、以下為 Orchid Home 的倒計時插件:
<plugin clsid="{AFC6BAE1-194B-487c-856C-70C540EFD189}" name="downcounter">
<background padding-top="0" padding-bottom="0" b-border-width="0" />
<label align="right" ellipsis="true" color="#4800d3">
<text lang="0x0804"><downtext refname="" ls=" ★★距離 " rs=" 還有 "/><downday refname="" invalid="0" isend="true" ls="" rs=" 天 "/></text>
<text lang="0x0404"><downtext refname="" ls=" 距離 " rs=" 還有 "/><downday refname="" invalid="0" isend="true" ls="" rs=" 天 "/></text>
</label>
</plugin>
這兩個都可以在 Orchid Home 里設置的,具體的方法為,當搖桿上下移動到時間上時,出現下劃線,再按確定鍵,就可以設置了。如圖:
最后還有一點要說明的:主題文件中 <scheme> 與 </scheme> 之間的就是配色文件,這里截了圖,來源: http://www.wmpol.com/viewthread.php?tid=20733&extra=page%3D2
呵呵,當然關于插件的代碼遠遠不止這些,由于本人水平有限,就提供這么多,大家以后還可以在友人網 596 的論壇里找我交流的 ~~
今天 ( 二○○七年元月七日 ) 剛好是偶買多普達 596 三個月的日子,特寫此文章作紀念,希望對一些剛剛開始玩智能手機的友人有一點點幫助 ~~~
End!
全文完.
新聞熱點
疑難解答
圖片精選