1

hello i have this simple view:

<?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@drawable/lavagna_verticale"
     android:orientation="vertical" > 
     
      <TextView
          android:id="@+id/voto_lavagna"
          android:layout_width="235sp"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
          android:gravity="center"
          android:textColor="@color/bianco"
          android:textSize="30sp"
          android:textStyle="bold"/>       
</RelativeLayout>

i can show an image into background all ok but with lint check:

Possible overdraw: Root element paints background @drawable/lavagna_verticale with a 
 theme that also paints a background (inferred theme is @android:style/Theme.Holo)

i created a new style:

    <style name="SfondoLavagnaVerticale" parent="@style/Theme.AppCompat">
        <item name="android:background">@drawable/lavagna_verticale</item>
 </style>

and change my view:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:theme="@style/SfondoLavagnaVerticale"
     android:orientation="vertical" > 
  ..
  ....
  .....

now i do not have error from lint but i can't show my image what i can do?

fabio
  • 271
  • 5
  • 18

1 Answers1

5

Replace

android:theme="@style/SfondoLavagnaVerticale"

With

style="@style/SfondoLavagnaVerticale"

in your RelativeLayout

To resolve lint error. Jump here "Possible overdraw: Root element paints background "

Community
  • 1
  • 1
Dominik Suszczewicz
  • 1,469
  • 2
  • 16
  • 23