Overdraw on separator

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 .


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.

链接地址: http://www.djcxy.com/p/31468.html

上一篇: 白色文本和使用xml代码android的黑色背景

下一篇: 在分离器上透支