Theme_HoloEverywhereLight_Sherlock showing dark background

白昼怎懂夜的黑 提交于 2019-12-11 17:52:55

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!