仿酷狗音乐播放器开发日志二十四 选项设置窗体的实现(附328行xml布局源码)...
轉載請說明原出處,謝謝~~
? ? ? ?花了兩天時間把仿酷狗的選項設置窗體做出來了,當然了只是做了外觀。現在開學了,寫代碼的時間減少,所以整個仿酷狗的工程開發速度減慢了。今天把仿酷狗的選項設置窗體的布局代碼分享出來,給學習duilib布局的朋友做個demo。現在編寫的仿酷狗選項設置窗體和原酷狗的窗體不細看幾乎看不出差別,控件的布局位置和原酷狗最多只有幾個像素的位置差別。
? ? ? ?先來看一下原酷狗的選項設置窗體的其中一個頁面:
? ? ? ?如果還不太會布局的朋友可以先看我前些日子寫的關于duilib布局的博客《duilib各種布局的作用,相對布局與絕對布局的的意義與用法》。可以看出來,選項設置窗體的整體布局并不復雜,但是其中分為多個頁面,而每個頁面里面又有許多控件,所以寫這個窗體的布局簡單而繁瑣。這是我的眼中的布局圖:
? ? ? ? 左側使用縱向布局內嵌Option控件實現,而右側界面的主界面使用TabLayout布局實現切換的功能。每個頁面使用縱向布局來做容器。
? ? ? ?在設置窗體里大量用到Label、Button、Option、CheckBox控件,為了避免重復寫屬性代碼,所以應該使用Default標簽定義這幾個控件的默認屬性,比如字體顏色,禁用狀態下的字體顏色,CheckBox控件的狀態圖等。這里給出默認標簽的代碼:
<Default name="Label" value="autocalcwidth="true" textcolor="#FF454545" " /> <Default name="Button" value="autocalcwidth="true" textcolor="#FF454545" disabledtextcolor="#FF454545" " /> <Default name="CheckBox" value="textcolor="#FF454545" disabledtextcolor="#FF888888" width="10" height="14" textpadding="16,1,0,0" align="left" normalimage="file='UI\setting\check_normal.png' dest='0,0,14,14'" hotimage="file='UI\setting\check_hover.png' dest='0,0,14,14'" pushedimage="file='UI\setting\check_down.png' dest='0,0,14,14'" disabledimage="file='UI\setting\check_disable.png' dest='0,0,14,14'" selectedimage="file='UI\setting\checked_normal.png' dest='0,0,14,14'" selectedhotimage="file='UI\setting\checked_hover.png' dest='0,0,14,14'" selectedpushedimage="file='UI\setting\checked_down.png' dest='0,0,14,14'" autocalcwidth="true""/>
? ? ? ?我這里使用了autocalcwidth屬性,這是我另外添加的屬性,是群里朋友修改的代碼。用來讓Label控件根據問題內容而自動計算寬度,這樣可以省去很多時間讓我專心把時間投入到布局上面。
? ? ? ?如同我在前面的博客提到的,能不使用絕對布局就不用,所以在這整個布局代碼中,只有兩三處必須用絕對布局的地方我才使用了絕對布局,其余代碼都是使用相對布局。所以這些布局代碼可以幫助duilib新手朋友學習相對布局的用法。
? ? ? 開發仿酷狗時我使用的是duilib的擴展版本uilib庫,而且我又對uilib庫進行過很多次的bug和性能修復(具體的修復代碼可以從前面的博客看到),所以今天發出來的布局代碼大家不能直接拷貝后使用,而要根據自己的情況進行必要的修改。沒有什么其他要點了,直接發出效果圖。一共九張 ,分別對應酷狗選項設置窗體的九個頁面。
? ? ? ?下面把完全的布局代碼貼出來,博客最后會把布局的下載鏈接也發出來:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <Window size="632,484" sizebox="4,4,4,4" caption="0,0,0,30" mininfo="632,484" roundcorner="3,3" bktrans="false" ><Font name="宋體" size="12" default="true"/><Font name="宋體" size="12" bold="true" /><Default name="Label" value="autocalcwidth="true" textcolor="#FF454545" " /><Default name="Button" value="autocalcwidth="true" textcolor="#FF454545" disabledtextcolor="#FF454545" " /><Default name="CheckBox" value="textcolor="#FF454545" disabledtextcolor="#FF888888" width="10" height="14" textpadding="16,1,0,0" align="left" normalimage="file='UI\setting\check_normal.png' dest='0,0,14,14'" hotimage="file='UI\setting\check_hover.png' dest='0,0,14,14'" pushedimage="file='UI\setting\check_down.png' dest='0,0,14,14'" disabledimage="file='UI\setting\check_disable.png' dest='0,0,14,14'" selectedimage="file='UI\setting\checked_normal.png' dest='0,0,14,14'" selectedhotimage="file='UI\setting\checked_hover.png' dest='0,0,14,14'" selectedpushedimage="file='UI\setting\checked_down.png' dest='0,0,14,14'" autocalcwidth="true""/><VerticalLayout bkcolor="#FFFFFFFF" bordercolor="#FF47484B" bordersize="1" inset="1,1,1,1"><HorizontalLayout name="background" height="30" bkimage="file='UI\BKImage\4.jpg' source='0,0,1000,30'" ><!-- 標題欄 --><Label text="選項設置——Redrain播放器" textcolor="#FFFFFFFF" textpadding="5,0,0,0" font="1" autocalcwidth="false" width="300"/><Control /><Button name="closebtn" width="23" height="18" padding="0,6,0,0" normalimage="UI\title\close_normal.png" hotimage="UI\title\close_hover.png" pushedimage="UI\title\close_down.png" /> </HorizontalLayout><HorizontalLayout ><VerticalLayout width="135" inset="7,0,0,0" bkcolor="#FFE0F2FE" rightbordersize="1" bordercolor="#FFCEDEEA"><!-- 左側選項卡 --><Label bkimage="UI\setting\lblTop.png" padding="0,24,0,0" width="128" height="28" /><Option name="setting_OptConv" width="128" height="26" normalimage="UI\setting\conv_normal.png" hotimage="UI\setting\conv_hover.png" pushedimage="UI\setting\conv_down.png" group="Setting_Tab" selectedimage="UI\setting\conv_down.png" selected="true" bindtablayoutname="setting_Tab" bindtabindex="0"/><Option name="setting_OptDownload" width="128" height="26" normalimage="UI\setting\download_normal.png" hotimage="UI\setting\download_hover.png" pushedimage="UI\setting\download_down.png" group="Setting_Tab" selectedimage="UI\setting\download_down.png" bindtablayoutname="setting_Tab" bindtabindex="1"/><Option name="setting_OptAcce" width="128" height="26" normalimage="UI\setting\acce_normal.png" hotimage="UI\setting\acce_hover.png" pushedimage="UI\setting\acce_down.png" group="Setting_Tab" selectedimage="UI\setting\acce_down.png" bindtablayoutname="setting_Tab" bindtabindex="2"/><Option name="setting_OptUpdate" width="128" height="26" normalimage="UI\setting\update_normal.png" hotimage="UI\setting\update_hover.png" pushedimage="UI\setting\update_down.png" group="Setting_Tab" selectedimage="UI\setting\update_down.png" bindtablayoutname="setting_Tab" bindtabindex="3"/><Label bkimage="UI\setting\lblMid.png" padding="0,30,0,0" width="128" height="28" /><Option name="setting_OptLrcDest" width="128" height="26" normalimage="UI\setting\lrc_dest_normal.png" hotimage="UI\setting\lrc_dest_hover.png" pushedimage="UI\setting\lrc_dest_down.png" group="Setting_Tab" selectedimage="UI\setting\lrc_dest_down.png" bindtablayoutname="setting_Tab" bindtabindex="4"/><Option name="setting_OptLrcWnd" width="128" height="26" normalimage="UI\setting\lrc_wnd_normal.png" hotimage="UI\setting\lrc_wnd_hover.png" pushedimage="UI\setting\lrc_wnd_down.png" group="Setting_Tab" selectedimage="UI\setting\lrc_wnd_down.png" bindtablayoutname="setting_Tab" bindtabindex="5"/><Label bkimage="UI\setting\lblBot.png" padding="0,30,0,0" width="128" height="28" /><Option name="setting_OptAudio" width="128" height="26" normalimage="UI\setting\Audio_normal.png" hotimage="UI\setting\Audio_hover.png" pushedimage="UI\setting\Audio_down.png" group="Setting_Tab" selectedimage="UI\setting\Audio_down.png" bindtablayoutname="setting_Tab" bindtabindex="6"/><Option name="setting_OptNet" width="128" height="26" normalimage="UI\setting\net_normal.png" hotimage="UI\setting\net_hover.png" pushedimage="UI\setting\net_down.png" group="Setting_Tab" selectedimage="UI\setting\net_down.png" bindtablayoutname="setting_Tab" bindtabindex="7"/><Option name="setting_OptOther" width="128" height="26" normalimage="UI\setting\other_normal.png" hotimage="UI\setting\other_hover.png" pushedimage="UI\setting\other_down.png" group="Setting_Tab" selectedimage="UI\setting\other_down.png" bindtablayoutname="setting_Tab" bindtabindex="8"/></VerticalLayout ><VerticalLayout><TabLayout name="setting_Tab" selectedid="0" inset="50,26,0,0"><!-- 主體界面 --><VerticalLayout childpadding="8,0,0,0"><!-- 第一個設置頁面 --><Button text="啟動時" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><HorizontalLayout height="14" padding="0,2,0,0"><CheckBox text="自動播放歌曲"/><CheckBox text="恢復上次播放的狀態" padding="106,0,0,0" /></HorizontalLayout><CheckBox text="播放Redrain問候語" selected="true" /><Button text="關閉主面板時" padding="0,12,0,0" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><Option text="最小化到系統托盤,不退出程序" padding="0,2,0,0" textcolor="#FF454545" disabledtextcolor="#FF454545" width="10" height="16" textpadding="18,1,0,0" align="left" normalimage="file='UI\setting\option_normal.png' dest='0,0,16,16'" hotimage="file='UI\setting\option_hover.png' dest='0,0,16,16'" pushedimage="file='UI\setting\option_down.png' dest='0,0,16,16'" disabledimage="file='UI\setting\option_disable.png' dest='0,0,16,16'" selectedimage="file='UI\setting\optioned_normal.png' dest='0,0,16,16'" selectedhotimage="file='UI\setting\optioned_hover.png' dest='0,0,16,16'" selectedpushedimage="file='UI\setting\optioned_down.png' dest='0,0,16,16'" autocalcwidth="true" group="SettingConv" selected="true" /><Option text="退出程序" padding="0,2,0,0" textcolor="#FF454545" disabledtextcolor="#FF454545" width="10" height="16" textpadding="18,1,0,0" align="left" normalimage="file='UI\setting\option_normal.png' dest='0,0,16,16'" hotimage="file='UI\setting\option_hover.png' dest='0,0,16,16'" pushedimage="file='UI\setting\option_down.png' dest='0,0,16,16'" disabledimage="file='UI\setting\option_disable.png' dest='0,0,16,16'" selectedimage="file='UI\setting\optioned_normal.png' dest='0,0,16,16'" selectedhotimage="file='UI\setting\optioned_hover.png' dest='0,0,16,16'" selectedpushedimage="file='UI\setting\optioned_down.png' dest='0,0,16,16'" autocalcwidth="true" group="SettingConv"/><Button text="其他設置" padding="0,12,0,0" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><CheckBox text="關閉網絡功能,作為本地播放器使用。(試聽和下載會重新打開網絡功能)"/><CheckBox text="允許彈出推廣信息" selected="true"/><CheckBox text="開機時自動啟動Redrain播放器"/><CheckBox text="開機時啟動桌面寫真"/><CheckBox text="USB連接時顯示設備接入提示" selected="true"/><Button text="文件關聯" padding="0,12,0,0" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><CheckBox text="將Redrain播放器作為默認音樂播放器"/></VerticalLayout><VerticalLayout childpadding="8,0,0,0"><!-- 第二個設置頁面 --><Button text="目錄設置" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><VerticalLayout height="85"><HorizontalLayout height="27" ><Label text="下載目錄 " width="65"/><Edit name="" text="D:\Redrain\" width="252" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /><Button name="" text="更改目錄" width="70" height="25" padding="12,0,0,0" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /></HorizontalLayout><HorizontalLayout height="27" ><Label text="歌詞目錄 " width="65"/><Edit name="" text="D:\Redrain\Lyric\" width="252" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /><Button name="" text="更改目錄" width="70" height="25" padding="12,0,0,0" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /></HorizontalLayout><HorizontalLayout height="27" ><Label text="緩存目錄 " width="65"/><Edit name="" text="D:\Redrain\Temp\" width="252" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /><Button name="" text="更改目錄" width="70" height="25" padding="12,0,0,0" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /></HorizontalLayout></VerticalLayout><HorizontalLayout height="24"><Label text="緩存大小設置" textpadding="0,3,0,0" width="75"/><Option text="自動" padding="30,3,0,0" textcolor="#FF454545" disabledtextcolor="#FF454545" width="10" height="16" textpadding="18,1,0,0" align="left" normalimage="file='UI\setting\option_normal.png' dest='0,0,16,16'" hotimage="file='UI\setting\option_hover.png' dest='0,0,16,16'" pushedimage="file='UI\setting\option_down.png' dest='0,0,16,16'" disabledimage="file='UI\setting\option_disable.png' dest='0,0,16,16'" selectedimage="file='UI\setting\optioned_normal.png' dest='0,0,16,16'" selectedhotimage="file='UI\setting\optioned_hover.png' dest='0,0,16,16'" selectedpushedimage="file='UI\setting\optioned_down.png' dest='0,0,16,16'" autocalcwidth="true" group="SettingDownload" selected="true" /><Option text="手動" padding="30,3,0,0" textcolor="#FF454545" disabledtextcolor="#FF454545" width="10" height="16" textpadding="18,1,0,0" align="left" normalimage="file='UI\setting\option_normal.png' dest='0,0,16,16'" hotimage="file='UI\setting\option_hover.png' dest='0,0,16,16'" pushedimage="file='UI\setting\option_down.png' dest='0,0,16,16'" disabledimage="file='UI\setting\option_disable.png' dest='0,0,16,16'" selectedimage="file='UI\setting\optioned_normal.png' dest='0,0,16,16'" selectedhotimage="file='UI\setting\optioned_hover.png' dest='0,0,16,16'" selectedpushedimage="file='UI\setting\optioned_down.png' dest='0,0,16,16'" autocalcwidth="true" group="SettingDownload" selected="true" /><HorizontalLayout width="60" height="22" padding="28,0,0,0" ><Edit name="" text="4704" width="60" height="22" bordercolor="#FFC5C5C5" textpadding="5,5,20,5" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /><Button float="true" pos="40,1,0,0" height="10" width="19" normalimage="UI\setting\arrowup_normal.png" hotimage="UI\setting\arrowup_hover.png" pushedimage="UI\setting\arrowup_down.png"/><Button float="true" pos="40,11,0,0" height="10" width="19" normalimage="UI\setting\arrowdown_normal.png" hotimage="UI\setting\arrowdown_hover.png" pushedimage="UI\setting\arrowdown_down.png"/></HorizontalLayout><Label text=" 512M-5210M" width="75" enabled="false" /></HorizontalLayout><Button text="速度控制" padding="0,12,0,0" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><Option text="全速下載" padding="0,8,0,0" textcolor="#FF454545" disabledtextcolor="#FF454545" width="10" height="16" textpadding="18,1,0,0" align="left" normalimage="file='UI\setting\option_normal.png' dest='0,0,16,16'" hotimage="file='UI\setting\option_hover.png' dest='0,0,16,16'" pushedimage="file='UI\setting\option_down.png' dest='0,0,16,16'" disabledimage="file='UI\setting\option_disable.png' dest='0,0,16,16'" selectedimage="file='UI\setting\optioned_normal.png' dest='0,0,16,16'" selectedhotimage="file='UI\setting\optioned_hover.png' dest='0,0,16,16'" selectedpushedimage="file='UI\setting\optioned_down.png' dest='0,0,16,16'" autocalcwidth="true" group="SettingConv" selected="true" /><HorizontalLayout height="24"><Option text="自定義" padding="0,5,0,0" textcolor="#FF454545" disabledtextcolor="#FF454545" width="10" height="16" textpadding="18,1,0,0" align="left" normalimage="file='UI\setting\option_normal.png' dest='0,0,16,16'" hotimage="file='UI\setting\option_hover.png' dest='0,0,16,16'" pushedimage="file='UI\setting\option_down.png' dest='0,0,16,16'" disabledimage="file='UI\setting\option_disable.png' dest='0,0,16,16'" selectedimage="file='UI\setting\optioned_normal.png' dest='0,0,16,16'" selectedhotimage="file='UI\setting\optioned_hover.png' dest='0,0,16,16'" selectedpushedimage="file='UI\setting\optioned_down.png' dest='0,0,16,16'" autocalcwidth="true" group="SettingConv"/><Label text="下載帶寬" textpadding="20,5,0,0" /><Button name="" text="最快速度" align="left" textpadding="6,6,0,0" width="73" height="24" padding="10,0,0,0" normalimage="file='UI\setting\combo_normal.png' corner='20,0,20,0'" hotimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" pushedimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" /><Label text="KB/s" textpadding="3,5,0,0" /><Label text="上載帶寬" textpadding="20,5,0,0" /><Button name="" text="無限制" align="left" textpadding="6,6,0,0" width="73" height="24" padding="10,0,0,0" normalimage="file='UI\setting\combo_normal.png' corner='20,0,20,0'" hotimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" pushedimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" /><Label text="KB/s" textpadding="3,5,0,0" /></HorizontalLayout> <CheckBox text="開啟VIP下載加速" enabled="false" /><Button text="其他" padding="0,12,0,0" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><CheckBox text="每次下載彈出音質選擇框" selected="true" padding="0,8,0,0"/><HorizontalLayout height="27" ><Label text="同時下載文件數: " /><Edit name="" text="3" width="80" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /><Label text="下載端口: " width="65" padding="30,0,0,0" /><Edit name="" text="8000" width="80" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /> </HorizontalLayout></VerticalLayout><VerticalLayout ><!-- 第三個設置頁面 --><Button text="播放設置" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><Button width="1" height="1" /><HorizontalLayout height="27" padding="0,8,0,0" ><Label text="播放/暫停" autocalcwidth="false" width="190"/><Edit name="" text="Alt + F5" align="center" width="166" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /></HorizontalLayout><HorizontalLayout height="27" ><Label text="上一首" autocalcwidth="false" width="190"/><Edit name="" text="Alt + Left" align="center" width="166" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /></HorizontalLayout><HorizontalLayout height="27" ><Label text="下一首" autocalcwidth="false" width="190"/><Edit name="" text="Alt + Right" align="center" width="166" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /></HorizontalLayout><HorizontalLayout height="27" ><Label text="快進" autocalcwidth="false" width="190"/><Edit name="" text="Ctrl + Shift + Right" align="center" width="166" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /></HorizontalLayout><HorizontalLayout height="27" ><Label text="快退" autocalcwidth="false" width="190"/><Edit name="" text="Ctrl + Shift + Left" align="center" width="166" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /></HorizontalLayout><HorizontalLayout height="27" ><Label text="增大音量" autocalcwidth="false" width="190"/><Edit name="" text="Ctrl + G" align="center" width="166" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /></HorizontalLayout><HorizontalLayout height="27" ><Label text="減小音量" autocalcwidth="false" width="190"/><Edit name="" text="Alt + Down" align="center" width="166" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /></HorizontalLayout><HorizontalLayout height="27" ><Label text="靜音" autocalcwidth="false" width="190"/><Edit name="" text="Ctrl + Alt + S" align="center" width="166" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /></HorizontalLayout><Button text="歌詞控制" padding="0,12,0,0" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><HorizontalLayout height="27" padding="0,8,0,0"><Label text="顯示/隱藏桌面歌詞" autocalcwidth="false" width="190"/><Edit name="" text="Ctrl + Alt + D" align="center" width="166" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /></HorizontalLayout><HorizontalLayout height="27" ><Label text="鎖定/解鎖桌面歌詞" autocalcwidth="false" width="190"/><Edit name="" text="Ctrl + Alt + E" align="center" width="166" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /></HorizontalLayout><HorizontalLayout height="25" padding="0,8,0,0"><CheckBox text="啟用全局快捷鍵" padding="0,5,0,0" selected="true" /><CheckBox text="彈出快捷鍵提示窗口" padding="30,5,0,0" /><Button text="恢復默認" width="90" height="25" padding="12,0,0,0" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /></HorizontalLayout></VerticalLayout><VerticalLayout childpadding="8,0,0,0"><!-- 第四個設置頁面 --><Button text="軟件更新" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><Label text="當前版本:Redrain播放器 V1000" /><Label text="更新事件:2014.8.25" /><Button text="手動檢查更新" width="100" height="25" padding="0,7,0,0" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /></VerticalLayout><VerticalLayout childpadding="8,0,0,0"><!-- 第五個設置頁面 --><Button text="目錄設置" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><CheckBox text="單行顯示歌詞" padding="0,8,0,0"/><HorizontalLayout height="24"><Label text="字體" textpadding="0,5,0,0" /><Button name="" text="黑體" align="left" textpadding="6,6,0,0" width="80" height="24" padding="10,0,0,0" normalimage="file='UI\setting\combo_normal.png' corner='20,0,20,0'" hotimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" pushedimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" /><Label text="字號" textpadding="20,5,0,0" /><Button name="" text="29" align="left" textpadding="6,6,0,0" width="80" height="24" padding="10,0,0,0" normalimage="file='UI\setting\combo_normal.png' corner='20,0,20,0'" hotimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" pushedimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" /><Label text="字形" textpadding="20,5,0,0" /><Button name="" text="粗體" align="left" textpadding="6,6,0,0" width="80" height="24" padding="10,0,0,0" normalimage="file='UI\setting\combo_normal.png' corner='20,0,20,0'" hotimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" pushedimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" /></HorizontalLayout> <HorizontalLayout height="25"><Label text="顏色" textpadding="0,5,0,0" /><Button text="未播放" align="left" foreimage="file='UI\setting\dest_lrc1.png' dest='3,3,30,22'" textpadding="36,6,0,0" width="82" height="25" padding="10,0,0,0" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /> <Button text="已播放" align="left" foreimage="file='UI\setting\dest_lrc2.png' dest='3,3,30,22'" textpadding="36,6,0,0" width="82" height="25" padding="10,0,0,0" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /><Label text="預設方案" textpadding="37,5,0,0" /><Button name="" text="海洋藍" align="left" textpadding="6,6,0,0" width="80" height="24" padding="10,0,0,0" normalimage="file='UI\setting\combo_normal.png' corner='20,0,20,0'" hotimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" pushedimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" /></HorizontalLayout> <HorizontalLayout height="25"><Label text="透明度" textpadding="0,5,0,0" /><Slider name="setting_dest_slider" height="21" width="239" min="0" max="100" value="0" step="1" padding="21,4,0,0" bkimage="file='UI\setting\SliderBK.png' dest='0,10,239,11'" foreimage="file='UI\setting\SliderFore.png'" isstretchfore="false" thumbimage="file='UI\skin\thumb_normal.png'" thumbhotimage="file='UI\skin\thumb_hover.png'" thumbpushedimage="file='UI\skin\thumb_hover.png'" thumbsize="21,21" sendmove="true" /><Label text="0%" textpadding="10,5,0,0" /></HorizontalLayout> <Button text="預覽" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><Control name="setting_dest_view" width="418" height="115" bkimage="UI\setting\view.png" /><Button text="恢復默認方案" width="100" height="25" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /></VerticalLayout><VerticalLayout childpadding="8,0,0,0"><!-- 第六個設置頁面 --><Button text="樣式設置" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><HorizontalLayout height="24"><Label text="字體" textpadding="0,5,0,0" /><Button name="" text="微軟雅黑" align="left" textpadding="6,6,0,0" width="80" height="24" padding="10,0,0,0" normalimage="file='UI\setting\combo_normal.png' corner='20,0,20,0'" hotimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" pushedimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" /><Label text="字號" textpadding="20,5,0,0" /><Button name="" text="18" align="left" textpadding="6,6,0,0" width="80" height="24" padding="10,0,0,0" normalimage="file='UI\setting\combo_normal.png' corner='20,0,20,0'" hotimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" pushedimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" /><Label text="字形" textpadding="20,5,0,0" /><Button name="" text="常規" align="left" textpadding="6,6,0,0" width="80" height="24" padding="10,0,0,0" normalimage="file='UI\setting\combo_normal.png' corner='20,0,20,0'" hotimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" pushedimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" /></HorizontalLayout> <HorizontalLayout height="25"><Label text="顏色" textpadding="0,5,0,0" /><Button text="未播放" align="left" foreimage="file='UI\setting\dest_wnd1.png' dest='3,3,30,22'" textpadding="36,6,0,0" width="82" height="25" padding="10,0,0,0" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /> <Button text="已播放" align="left" foreimage="file='UI\setting\dest_wnd2.png' dest='3,3,30,22'" textpadding="36,6,0,0" width="82" height="25" padding="10,0,0,0" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /><Label text="預設方案" textpadding="37,5,0,0" /><Button name="" text="活力黃" align="left" textpadding="6,6,0,0" width="80" height="24" padding="10,0,0,0" normalimage="file='UI\setting\combo_normal.png' corner='20,0,20,0'" hotimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" pushedimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" /></HorizontalLayout> <Button text="預覽" font="1" padding="0,8,0,0" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><Control name="setting_dest_view" width="415" height="110" bkimage="UI\setting\view2.png" /><Button text="恢復默認方案" padding="0,5,0,0" width="100" height="25" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /></VerticalLayout><VerticalLayout childpadding="8,0,0,0"><!-- 第七個設置頁面 --><Button text="輸出設置" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><VerticalLayout height="55"><HorizontalLayout height="27" ><Label text="音頻輸出 " width="65"/><Button name="" text="Default DirectSound Device" align="left" textpadding="6,6,0,0" width="327" height="22" padding="10,0,0,0" normalimage="file='UI\setting\combo_normal.png' corner='20,0,20,0'" hotimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" pushedimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" /></HorizontalLayout><HorizontalLayout height="27" ><Label text="視頻渲染 " width="65"/><Button name="" text="VMR9 窗口化" align="left" textpadding="6,6,0,0" width="327" height="22" padding="10,0,0,0" normalimage="file='UI\setting\combo_normal.png' corner='20,0,20,0'" hotimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" pushedimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" /></HorizontalLayout></VerticalLayout><Label text="提示:新設置的參數會在重新播放的時候生效。輸出設備推薦選擇DirectSound" height="18" enabled="false" /><Label text="輸出類型" textpadding="0,3,0,0" height="18" enabled="false" /><Button text="音頻設置" padding="0,20,0,0" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><CheckBox text="激活聲音淡入淡出效果" padding="0,8,0,0"/><HorizontalLayout height="24"><Label text="淡入" textpadding="0,3,0,0" /><HorizontalLayout width="60" height="22" padding="8,0,0,0" ><Edit name="" text="600" width="60" height="22" bordercolor="#FFC5C5C5" textpadding="5,5,20,5" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /><Button float="true" pos="40,1,0,0" height="10" width="19" normalimage="UI\setting\arrowup_normal.png" hotimage="UI\setting\arrowup_hover.png" pushedimage="UI\setting\arrowup_down.png"/><Button float="true" pos="40,11,0,0" height="10" width="19" normalimage="UI\setting\arrowdown_normal.png" hotimage="UI\setting\arrowdown_hover.png" pushedimage="UI\setting\arrowdown_down.png"/></HorizontalLayout><Label text=" 毫秒(1-10000)" width="75" /><Label text="淡出" textpadding="20,3,0,0" /><HorizontalLayout width="60" height="22" padding="8,0,0,0" ><Edit name="" text="600" width="60" height="22" bordercolor="#FFC5C5C5" textpadding="5,5,20,5" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /><Button float="true" pos="40,1,0,0" height="10" width="19" normalimage="UI\setting\arrowup_normal.png" hotimage="UI\setting\arrowup_hover.png" pushedimage="UI\setting\arrowup_down.png"/><Button float="true" pos="40,11,0,0" height="10" width="19" normalimage="UI\setting\arrowdown_normal.png" hotimage="UI\setting\arrowdown_hover.png" pushedimage="UI\setting\arrowdown_down.png"/></HorizontalLayout><Label text=" 毫秒(1-10000)" width="75" /></HorizontalLayout><Label text="提示:僅支持DirectSound輸出類型" height="18" enabled="false" /><HorizontalLayout height="26"><Button name="" text="設置均衡器" width="92" height="25" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /><Button name="" text="設置音效插件" width="92" height="25" padding="12,0,0,0" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /></HorizontalLayout> </VerticalLayout><VerticalLayout childpadding="8,0,0,0"><!-- 第八個設置頁面 --><Button text="代理" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><VerticalLayout height="130"><HorizontalLayout height="27" ><Label text="代理類型: " width="65"/><Button name="" text="HTTP代理" align="left" textpadding="6,6,0,0" width="130" height="22" padding="10,0,0,0" normalimage="file='UI\setting\combo_normal.png' corner='20,0,20,0'" hotimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" pushedimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" /><Button name="" text="測試" width="60" height="25" padding="15,0,0,0" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /></HorizontalLayout><HorizontalLayout height="27" padding="0,8,0,0"><Label text="代理地址: " width="65"/><Edit name="" width="130" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" padding="10,0,0,0" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /><Label text="端口: " padding="15,0,0,0" width="65"/><Edit name="" width="130" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" padding="10,0,0,0" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /></HorizontalLayout><HorizontalLayout height="27" padding="0,8,0,0"><Label text="用戶名: " width="65"/><Edit name="" width="130" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" padding="10,0,0,0" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /><Label text="密碼: " padding="15,0,0,0" width="65"/><Edit name="" width="130" height="22" bordercolor="#FFC5C5C5" focusbordercolor="#FF5AAFF7" textpadding="9,5,5,5" padding="10,0,0,0" textcolor="#FF454545" bkcolor="#00000000" nativebkcolor="#FFFFFFFF" /></HorizontalLayout><HorizontalLayout height="27" padding="0,8,0,0"><Label text="域(可不填) " width="65"/><Button name="" text="HTTP代理" align="left" textpadding="6,6,0,0" width="130" height="22" padding="10,0,0,0" normalimage="file='UI\setting\combo_normal.png' corner='20,0,20,0'" hotimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" pushedimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" /><CheckBox text="使用服務器中轉" padding="15,5,0,0"/></HorizontalLayout></VerticalLayout><Button text="網絡連接" padding="0,20,0,0" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><HorizontalLayout height="27" ><Label text="您當前的網絡連接運營商是: " width="65"/><Button name="" text="未知" align="left" textpadding="6,6,0,0" width="100" height="22" padding="10,0,0,0" normalimage="file='UI\setting\combo_normal.png' corner='20,0,20,0'" hotimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" pushedimage="file='UI\setting\combo_down.png' corner='20,0,20,0'" /><Button name="" text="自動選擇最優" width="80" height="25" padding="12,0,0,0" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /></HorizontalLayout><HorizontalLayout height="27" ><Label text="您當前的網絡連接方式是:UDP " width="65"/><Button name="" text="網絡測試" width="80" height="25" padding="115,0,0,0" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /></HorizontalLayout> </VerticalLayout><VerticalLayout childpadding="8,0,0,0"><!-- 第九個設置頁面 --><Button text="主播模式" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><HorizontalLayout height="16" padding="0,8,0,0"><Option text="啟動" textcolor="#FF454545" disabledtextcolor="#FF454545" width="10" height="16" textpadding="18,1,0,0" align="left" normalimage="file='UI\setting\option_normal.png' dest='0,0,16,16'" hotimage="file='UI\setting\option_hover.png' dest='0,0,16,16'" pushedimage="file='UI\setting\option_down.png' dest='0,0,16,16'" disabledimage="file='UI\setting\option_disable.png' dest='0,0,16,16'" selectedimage="file='UI\setting\optioned_normal.png' dest='0,0,16,16'" selectedhotimage="file='UI\setting\optioned_hover.png' dest='0,0,16,16'" selectedpushedimage="file='UI\setting\optioned_down.png' dest='0,0,16,16'" autocalcwidth="true" group="SettingOther1" /><Option text="關閉" textcolor="#FF454545" disabledtextcolor="#FF454545" width="10" height="16" textpadding="18,1,0,0" align="left" normalimage="file='UI\setting\option_normal.png' dest='0,0,16,16'" hotimage="file='UI\setting\option_hover.png' dest='0,0,16,16'" pushedimage="file='UI\setting\option_down.png' dest='0,0,16,16'" disabledimage="file='UI\setting\option_disable.png' dest='0,0,16,16'" selectedimage="file='UI\setting\optioned_normal.png' dest='0,0,16,16'" selectedhotimage="file='UI\setting\optioned_hover.png' dest='0,0,16,16'" selectedpushedimage="file='UI\setting\optioned_down.png' dest='0,0,16,16'" autocalcwidth="true" group="SettingOther1" selected="true" /> </HorizontalLayout> <Label text="繁星主播專用。開播更流暢,并能識別當前播的歌" enabled="false" /><Button text="主播上線提醒" font="1" enabled="false" align="left" bkimage="UI\setting\sepline.png" width="420" height="13" /><HorizontalLayout height="16" padding="0,8,0,0"><Option text="啟動" textcolor="#FF454545" disabledtextcolor="#FF454545" width="10" height="16" textpadding="18,1,0,0" align="left" normalimage="file='UI\setting\option_normal.png' dest='0,0,16,16'" hotimage="file='UI\setting\option_hover.png' dest='0,0,16,16'" pushedimage="file='UI\setting\option_down.png' dest='0,0,16,16'" disabledimage="file='UI\setting\option_disable.png' dest='0,0,16,16'" selectedimage="file='UI\setting\optioned_normal.png' dest='0,0,16,16'" selectedhotimage="file='UI\setting\optioned_hover.png' dest='0,0,16,16'" selectedpushedimage="file='UI\setting\optioned_down.png' dest='0,0,16,16'" autocalcwidth="true" group="SettingOther2" selected="true" /><Option text="關閉" textcolor="#FF454545" disabledtextcolor="#FF454545" width="10" height="16" textpadding="18,1,0,0" align="left" normalimage="file='UI\setting\option_normal.png' dest='0,0,16,16'" hotimage="file='UI\setting\option_hover.png' dest='0,0,16,16'" pushedimage="file='UI\setting\option_down.png' dest='0,0,16,16'" disabledimage="file='UI\setting\option_disable.png' dest='0,0,16,16'" selectedimage="file='UI\setting\optioned_normal.png' dest='0,0,16,16'" selectedhotimage="file='UI\setting\optioned_hover.png' dest='0,0,16,16'" selectedpushedimage="file='UI\setting\optioned_down.png' dest='0,0,16,16'" autocalcwidth="true" group="SettingOther2" /></HorizontalLayout><Label text="關閉的主播上線后提醒。讓您不錯過每一個主播的每一個瞬間" enabled="false" /> </VerticalLayout></TabLayout><HorizontalLayout height="50" inset="6,5,0,0" ><!-- 狀態欄 --><Button name="okbtn" text="確定" width="90" height="25" padding="165,0,0,0" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /><Button name="closebtn" text="取消" width="90" height="25" padding="12,0,0,0" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /><Button name="applybtn" text="應用" width="90" height="25" padding="12,0,0,0" normalimage="file='UI\skin\button_normal.png' corner='5,5,5,5'" hotimage="file='UI\skin\button_hover.png' corner='5,5,5,5'" pushedimage="file='UI\skin\button_down.png' corner='5,5,5,5'" /></HorizontalLayout></VerticalLayout> </HorizontalLayout> </VerticalLayout> </Window>
? ? ? ? xml布局文件下載地址:點擊打開鏈接
? ?Redrian ? 2014.8.26
轉載于:https://www.cnblogs.com/redrainblog/p/3938152.html
總結
以上是生活随笔為你收集整理的仿酷狗音乐播放器开发日志二十四 选项设置窗体的实现(附328行xml布局源码)...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 自学python(2):利用opencv
- 下一篇: 高清视频格式的几个概念