我想改变主题我的应用程序button
点击。我在我的Activity
中定义了onClick()
函数。我想改变我的整个应用程序的主题
我的代码:
public class Screen2 extends Activity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.secondscreen);
}
public void theme(View view){
getApplication().setTheme(android.R.style.Theme_Holo);
}
它不工作。你能帮我改变我的应用程序的主题吗?
在此先感谢。
我你读Android文档'setTheme()'只有之前被称为'的setContentView()'。之后无法完成。 http://developer.android.com/reference/android/view/ContextThemeWrapper.html#setTheme%28int%29 – Abhilasha 2012-07-20 10:33:36
这意味着我们不能通过按钮点击动态地改变整个应用程序活动的主题,除非单独的活动请帮助我。 – 2012-07-20 13:01:57