Overdraw on separator

1.8k views Asked by At

When buidling with gradle the lint report reports the following:

Overdraw: Painting regions more than once

../../src/main/res/layout/include_divider.xml:4: Possible overdraw: Root element paints background @color/gray with a theme that also paints a background (inferred theme is @style/AppTheme)

1 View xmlns="http://schemas.android.com/apk/res/android"
2 android:layout_width="fill_parent"
3 android:layout_height="1px"
4 android:background="@color/gray" />

I know the problem is I am painting over an already painted part of screen. How can I set the theme properly? Or how can I set a proper separator to get rid of this issue?

The theme I am using is Theme.AppCompat.Light.

1

There are 1 answers

0
Catalin Morosan On BEST ANSWER

Overdraw should be reduced as much as possible but there will unavoidably be some overdraw in your screens.

In your particular case, it's OK that you draw a 1px divider over the existing background. The lint warnings try their best to pinpoint possible issues but they are not bulletproof. You can safely suppress this lint warning for this particular View.