"Possible overdraw: Root element paints background "
To optimize your apps performance (avoid overdraw), you can do the following:
declare a theme in
res/values/styles.xml
<style name="MyTheme" parent="android:Theme"> <item name="android:background">@drawable/main</item> <item name="android:windowNoTitle">true</item> <item name="android:windowFullscreen">true</item> </style>
change the Manifest:
<application android:icon="@drawable/ic_logo" android:label="@string/app_name" android:theme="@style/MyTheme" >
- remove the background declaration in "My xml"
Update
Check out the comments or check out this link. As Marcin mentions, my solution here is not a good approach since it can cause artefacts. I've been using it to avoid overdraw for a long time without any problems but in general might be not a thumb of rule according to the Chet Haase comments on this technique.
Original answer
The best approach I've found is to set as null the default background and apply the background you need in each layout.
The reason is when you set a default background in a theme, or even different themes with different backgrounds as suggested above, this means the whole layout will be fill with that background. In most cases you don't need a background filling 100% of the screen because you have toolbars, headers, footers and other elements on top of that background that will cause overdraw.
To apply null background on a theme:
<style
name="ThemeName" parent="ParentTheme">
<item name="android:windowBackground">@null</item>
</style>
To check overdraw just activate the Show Overdraw option in the dev options on your emulator/device. Don't trust 100% lint warnings because there was some bugs in the tracker that I'm not sure are completely fixed.
More information: What is overdraw and why is an issue?