您的位置:首页 > 产品设计 > UI/UE

background overdraw

2016-06-16 16:45 507 查看
../../src/main/res/layout/progress_dialog_layout.xml:6:

Possible overdraw: Root element paints background @color/theme_color_window_background with a theme that also paints a background (inferred theme is @style/AppTheme)

<LinearLayout
android:id="@+id/dialog_view"
android:layout_width="fill_parent"
android:layout_height="72dip"
android:background="@color/theme_color_window_background"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp">


Priority: 3 / 10

Category: Performance

Severity: Warning

Explanation: Overdraw: Painting regions more than once.

If you set a background drawable on a root view, then you should use a custom theme where the theme background is null. Otherwise, the theme background will be painted first, only to have your custom background completely cover it; this is called “overdraw”.

NOTE: This detector relies on figuring out which layouts are associated with which activities based on scanning the Java code, and it’s currently doing that using an inexact pattern matching algorithm. Therefore, it can incorrectly conclude which activity the layout is associated with and then wrongly complain that a background-theme is hidden.

If you want your custom background on multiple pages, then you should consider making a custom theme with your custom background and just using that theme instead of a root element background.

Of course it’s possible that your custom drawable is translucent and you want it to be mixed with the background. However, you will get better performance if you pre-mix the background with your drawable and use that resulting image or color as a custom theme background instead.

More info:

To suppress this error, use the issue id “Overdraw” as explained in the Suppressing Warnings and Errors section.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  UI