Android換膚_MultipleTheme


MultipleTheme

真正的支持無縫換膚/夜間模式的Android框架,配合theme和換膚控件框架可以做到無縫切換換膚(無需重啓應用和當前頁面)。

該應用框架可以實現無縫換膚/切換夜間模式的需求,需要在換膚/切換夜間模式的界面只需要使用框架裏的自封裝控件,其他界面的控件使用原生android控件即可。

This framework of Android app support multiple theme(such as day/night mode) and needn’t finish current application or current activity.

第一步:在項目的attr.xml聲明自定義屬性(各種模式都會用到的屬性)

Setup 1:declare attribute in attr.xml

github

第二步:在項目的style.xml指定各種模式主題下的自定義屬性值

Setup 2:declare attribute in style.xml

github

第三步:在頁面佈局文件裏使用自定義屬性值

Setup 3:use attribute in layout

github

第四步:在基類的onCreate方法裏添加切換主題模式的邏輯代碼

Setup 4:add the code of switch theme-mode in base activity

github

第五步:調用工具類方法切換主題模式

Setup 5:switch theme-mode in code

github

第六步:針對切換主題模式時需要立即更新頁面ui的頁面,需要使用框架裏的封裝控件

Setup 6:use customize-widget of framework at the activity that need update ui when switch theme-mode.

githubgithub


demo網址:https://github.com/dersoncheng/MultipleTheme.git


發佈了30 篇原創文章 · 獲贊 15 · 訪問量 9萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章