2013-01-09 18 views
1

我想在我的應用程序中使用兩種風格:android:Theme.Black和android:Theme.Light。在應用程序安裝並運行時,用戶可以選擇樣式。Android在應用程序運行時改變風格

我的問題:如何改變應用程序的風格,當它運行?對我來說非常重要。非常非常感謝,

PS 風格在RES /價值/ styles.xml定義

+0

使用搜索:http://stackoverflow.com/questions/2482848/how-to-change-current-theme-at-runtime-in-android – Leonidos

回答

0

我解決了它:

getApplication().setTheme(R.style.BlackTheme);

/res/values/styles.xml

<resources> 
    <style name="BlackTheme" parent="@android:style/Theme.Black"> 
    </style>  
</resources>