2012-02-08 13 views
4

塗料、それは、Androidのlintsにこの警告を表示されます。可能なオーバードロー:ルート要素が自分のアプリケーションでは背景

可能なオーバードロー:ルート要素は もバックグラウンドをペイントしたテーマで、メイン/描画可能@バックグラウンドをペイント(推論テーマは@androidです:スタイル/テーマ)私はこの間違いを修正する方法を知りたい

、原因がチェックし、インターネット上で確認した後に、私はちょうどそれがバックグラウンド2回をリロードする原因、それはアプリケーションの速度を低下していることが分かりますこの情報源を入れる

これは私のlayout.xmlの源である:

<?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/main" 
    android:orientation="vertical" > 

<TextView 
    android:id="@+id/textView1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginTop="120dp" 
    android:layout_centerHorizontal="true" 
    android:layout_marginLeft="20dp" 
    android:text="@string/alta1" 
    android:textColor="#000" 
    android:textAppearance="?android:attr/textAppearanceLarge" /> 

<TextView 
    android:id="@+id/textView2" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/textView1" 
    android:layout_marginTop="20dp" 
    android:layout_centerHorizontal="true" 
    android:text="@string/alta2" 
    android:layout_marginLeft="20dp" 
    android:textColor="#000" 
    android:textAppearance="?android:attr/textAppearanceSmall" /> 

<Button 
    android:id="@+id/continuaralta" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true" 
    android:layout_below="@+id/textView2" 
    android:layout_marginRight="50dp" 
    android:layout_marginTop="36dp" 
    android:textStyle="bold" 
    android:background="@drawable/boton" 
    android:text="@string/continuar" /> 

<Button 
    android:id="@+id/saliralta" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignBaseline="@+id/continuaralta" 
    android:layout_alignBottom="@+id/continuaralta" 
    android:layout_marginRight="15dp" 
    android:layout_toLeftOf="@+id/continuaralta" 
    android:background="@drawable/boton" 
    android:textStyle="bold" 
    android:text="@string/salir" /> 

答えて

6

ニール・セインズベリー、http://www.earthtoneil.com/で、ロマン・ガイがhttp://android-developers.blogspot.com/2009/03/window-backgrounds-ui-speed.htmlで根本的な問題に対処していることを述べています。 Neilのブログを参照して、エラーメッセージを検索してください。次に、http://developer.android.com/guide/topics/ui/themes.htmlにアクセスして、アプリ全体に背景テーマを適用する方法と個別のアクティビティを確認する方法をご覧ください。

この方法では、少なくともエラーメッセージが表示されなくなります。私の場合は、2つの矢印アイコンを押して修正を行った後にリントウインドウの警告を更新する必要がありました。

+0

あなたはこれを修正するために何をしたのか分かりませんが、あなたのテーマに ' @ null'を追加しましたか?私はそれを試みたが、私はまだ警告を見る。 – Franco

+0

私が理解したように、警告は修正されません。しかし、背景のスタイルアイテムを作成し、このスタイルをビューに設定すると、それが修正されます。しかし、私は思っています、それは単なる回避策です。この警告は無視しても同じ結果が得られます。 – Ov3r1oad

関連する問題