Android 使用样式在主题中设置活动背景?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11441297/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 07:25:32  来源:igfitidea点击:

Set activity background in theme using a style?

android

提问by user291701

I want to use a background drawable for all my activities. How can I do this with a style?

我想为我的所有活动使用可绘制的背景。我怎样才能用一种风格做到这一点?

// styles.xml
<style name="MyTheme" parent="Theme.Sherlock.Light.DarkActionBar.ForceOverflow">
    <item name="android:background">@drawable/my_background</item>  
</style>

that sets the background for all widgets it seems. I just want it to work for activities.

这似乎为所有小部件设置了背景。我只是想让它为活动工作。

Thanks

谢谢

回答by biegleux

Use

<item name="android:windowBackground">@drawable/my_background</item>