Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set activity background in theme using a style?

Tags:

android

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

like image 990
user291701 Avatar asked Jul 11 '12 20:07

user291701


People also ask

How do you apply theme and styles to an activity?

Apply a style as a theme You can create a theme the same way you create styles. The difference is how you apply it: instead of applying a style with the style attribute on a view, you apply a theme with the android:theme attribute on either the <application> tag or an <activity> tag in the AndroidManifest. xml file.

Where is Styles XML in Android Studio?

Defining Styles This XML file resides under res/values/ directory of your project and will have <resources> as the root node which is mandatory for the style file.


1 Answers

Use

<item name="android:windowBackground">@drawable/my_background</item>
like image 147
biegleux Avatar answered Oct 08 '22 19:10

biegleux