Meaning of Warning: Possible overdraw

Asked

Viewed 152 times

0

I have an app that shows Warning:

Possible overdraw: Root element Paints background @color/md_elegance_green with a Theme that also Paints a background (inferred Theme is @android:style/Theme_black_notitlebar_fullscreen)

The image illustrates the moment of the event:

inserir a descrição da imagem aqui

I did some research but I did not understand very well. What does it mean overdraw? How should I do the treatment so that no more appears this Warning?

  • In the manifest theme,xml points to a theme while the layout color says another. Just a warning that there might be an overdraw - overwrite a color that has already been applied. Remove the line "android:background="@color..." that Warning will no longer appear.

  • @Reginaldorigo but I really want this layout to have a different background than the main theme. What is your suggestion regarding this?

  • Set this color in the theme.

  • @Pabloalmeida but I want the background color of this layout to be different from the theme. Understand?!

  • @seamusd So you should set a different theme for this layout. Themes may have other themes as parent, inheriting all of its features. Then you overlay the background. See Hugo’s response.

  • http://stackoverflow.com/questions/11994454/possible-overdraw-root-element-paints-background

Show 1 more comment

1 answer

1

declares your theme in the archive: res/values/Styles.xml

<style name="MeuTema" parent="android:Theme">
    <item name="android:background">@color/md_elegance_green</item>
</style>

And uses this theme in Manifest.xml

android:theme="@style/MeuTema"

// EDIT

Parent="android:Theme" you put a top theme. In your case I believe it would be Theme_black_notitlebar_fullscreen

Browser other questions tagged

You are not signed in. Login or sign up in order to post.