问题
I'm using Christophe Versiuex's HoloEverywhere library in concert with ActionBarSherlock to display an ICS looking app on Gingerbread phones. The Theme.HoloEverywhereDark.Sherlock theme works great. But when I try to change the theme to Theme.HoloEverywhereLight.Sherlock, all the text changes to dark text, but the Activity backgrounds stay dark.
All I'm doing is:
setTheme(R.style.Theme_HoloEverywhereLight_Sherlock);
setContentView(R.layout.mylayout);
in the Activity.onCreate() method.
In looking at the code, it defines:
<style name="Theme.HoloEverywhereLight.Sherlock" parent="Theme.Sherlock.Light">
<item name="android:windowBackground">@drawable/background_holo_light</item>
.
.
.
so it looks like it should work.
Has anyone else used the Light theme and gotten a light background?
Thanx.
回答1:
I figured this out. I was doing:
super.onCreate(savedInstanceState);
setTheme(R.style.Theme_HoloEverywhereLight_Sherlock);
setContentView(R.layout.mylayout);
when I should have been doing:
setTheme(R.style.Theme_HoloEverywhereLight_Sherlock);
super.onCreate(savedInstanceState);
setContentView(R.layout.mylayout);
setTheme() needed to be called before super.onCreate(). Now the light theme works like a charm.
来源:https://stackoverflow.com/questions/11172965/theme-holoeverywherelight-sherlock-showing-dark-background