我想设置整个应用程序主题。我的代码在ICe-Creme Sandwich和更高版本中运行良好,但它不适用于较低版本,不会出现任何错误。
这是我的代码:
我在调用setcontentView();
之前使用以下代码设置主题SharedPreferences pref=context.getSharedPreferences(HomeSAFEPref.HomeSAFEPref,0);
int position= pref.getInt("BackgroundPosition", 0);
switch (position) {
case 0:
context.setTheme(R.style.Background0);
break;
case 1:
context.setTheme(R.style.Background1);
break;
case 2:
context.setTheme(R.style.Background2);
break;
case 3:
context.setTheme(R.style.Background3);
break;
case 4:
context.setTheme(R.style.Background4);
break;
}
以上代码在较高版本中运行良好,但不适用于较低版本。
以下是样式代码:
<style name="Background0" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@drawable/bigl_1</item>
<item name="android:windowNoTitle">true</item>
</style>
请建议