且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我要如何更改为全息暗/灯光主题,从应用程序内?

更新时间:2023-12-04 22:07:46

我认为,你可以使用 setTheme()办法做到这一点。只要确保你怎么称呼它,你之前使用的setContentView ,否则将无法正常工作。

I think that you can do it by using the setTheme() method. Just make sure that you call it before you use setContentView, or it won't work.

例如:

if(userChoice ==1){
   setTheme(android.R.style.Theme_Holo_Light);
else if(userChoice == 2){
    setTheme(android.R.style.Theme_Holo);
}

这里

主题列表,可以发现

A list of themes can be found here