Possible overdraw: Root element paints background with a theme that also paints a background Possible overdraw: Root element paints background with a theme that also paints a background xml xml

Possible overdraw: Root element paints background with a theme that also paints a background


By default, a theme has android:windowBackground attribute specified, which specifies, as the name implies, the background of the window, where your activity is being launched.

This lint warning just tells you following:

Hey! I see your theme has a windowBackground applied, and your root layout draws some other drawable on top of window background, making window's background pointless - thus overdrawing pixels needlessly.

Nulling out windowBackground would make lint not to complain:

<style name="AppTheme" parent="...">    ...    <item name="android:windowBackground">@null</item></style>


You should put the ripple on the foreground attribute


I would just remove the lint check. It's perfectly acceptable to have x1 overdraw for most of the apps.

There's a very good post about overdraw and performance from Romain Guy there: http://www.curious-creature.com/2012/12/01/android-performance-case-study/.

Setting <item name="android:windowBackground">@null</item> in your theme is wrong because it will remove your activity launch animation (see that post for more details about the launch animation: https://cyrilmottier.com/2013/01/23/android-app-launching-made-gorgeous/). You shouldn't do that.

Setting getWindow().setBackgroundDrawable(null) in Activity.onCreate() is doable but you have to make sure each and every pixel in your app is painted at least once since you won't have a background to paint against anymore. It's potentially dangerous for a very limited gain.