Grey background colors in views although white background defined and working first
<p>I have a strange problem. My App ist working perfectly on my Samsung Galaxy II S with Android 2.3.4. On my tablet with Android 3.0 there is a strange behaviour:</p>

<p>Background colors, which are explicit set to white suddencly are different grey's.</p>

<ul>
<li>I have two activities which are affected, one with a WebView which is a bit more complex and one which is really simple with only 4 buttons. They all have explicit white as a background for their LinearLayout, ScrollView, TextViews etc.</li>
<li>The app starts, everything is correct, the background's are white</li>
<li>I switch back and forth to the complex activity and after some time the background are no longer white, but in different grey tones. After that point, they remain grey, also for the simple activity with the 4 buttons</li>
<li>I do not alter the background color in code</li>
</ul>

<p>The following points could lead to this behaviour:</p>

<ul>
<li>Using the WebView. It is used not all the time and it seems that this behaviour occours much faster/only if the WebView is visible</li>
<li>Changing the orieantation seems to push this behaviour</li>
</ul>

<p>What I have tried so far:</p>

<ul>
<li>Disable hardware accelaration</li>
<li>Force redraw</li>
<li>Tried to rearrange the views in the complex activity so they do not overlap to get rid of the warning "Can't get the viewWidth after the first layout"</li>
</ul>

<p>For me it seems as this would be a sort of a visual debugging mode, but I haven't found anything about such a mode in the web.</p>

<p>Probably the only hint:
I get a warning: Can't get the viewWidth after the first layout</p>

<p>Code for the simply activity</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white"
android:orientation="vertical" &gt;

&lt;Button
    android:id="@+id/ag_btn_pressespiegel"
    android:text="@string/artikelgruppen_pressespiegelbutton"
    android:layout_width="fill_parent"
    android:layout_marginLeft="8dp"
    android:layout_marginRight="8dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="16dp"
    android:textColor="@color/black"
    android:layout_marginBottom="16dp" /&gt;

&lt;Button
    android:id="@+id/ag_btn_dossier"
    android:text="@string/artikelgruppen_dossierbutton"
    android:layout_marginLeft="8dp"
    android:layout_marginRight="8dp"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textColor="@color/black"
    android:layout_marginBottom="16dp" /&gt;

&lt;Button
    android:id="@+id/ag_btn_tag"
    android:text="@string/artikelgruppen_tagbutton"
    android:layout_marginLeft="8dp"
    android:layout_marginRight="8dp"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textColor="@color/black"
    android:layout_marginBottom="32dp" /&gt;

&lt;Button
    android:id="@+id/ag_btn_sync"
    android:text="@string/artikelgruppen_syncbutton"
    android:layout_marginLeft="8dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textColor="@color/black"
    android:layout_marginBottom="16dp" /&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>Code for the compley activity with the WebView</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ad_sv_artikeldetails"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white" &gt;

&lt;RelativeLayout
    android:id="@+id/ad_rl_artikeldetails"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@color/white" &gt;

    &lt;RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="100dp"
        android:background="@color/white" &gt;

        &lt;ImageView
            android:id="@+id/ad_img_kanal"
            android:layout_width="32dp"
            android:layout_height="32dp"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_marginLeft="5dp"
            android:layout_marginTop="5dp" &gt;
        &lt;/ImageView&gt;

        &lt;ImageView
            android:id="@+id/ad_img_pdf"
            android:layout_width="24dp"
            android:layout_height="16dp"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_marginRight="6dp"
            android:layout_marginTop="54dp"
            android:src="@drawable/pdfdocument" &gt;
        &lt;/ImageView&gt;

        &lt;ImageView
            android:id="@+id/ad_img_land"
            android:layout_width="16dp"
            android:layout_height="16dp"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_marginRight="4dp"
            android:layout_marginTop="5dp" &gt;
        &lt;/ImageView&gt;

        &lt;TextView
            android:id="@+id/ad_txt_medie"
            android:layout_width="wrap_content"
            android:layout_height="24dp"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_marginLeft="43dp"
            android:layout_marginRight="120dp"
            android:layout_marginTop="22dp"
            android:maxLines="1"
            android:background="@color/white"
            android:textColor="@color/black" &gt;
        &lt;/TextView&gt;

        &lt;TextView
            android:id="@+id/ad_txt_datum"
            android:layout_width="wrap_content"
            android:layout_height="16dp"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_marginRight="6dp"
            android:background="@color/white"
            android:layout_marginTop="22dp" &gt;
        &lt;/TextView&gt;
    &lt;/RelativeLayout&gt;

    &lt;!-- Titel &amp; Grosses Linarlayout für vertikale Anordnung --&gt;

    &lt;LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="80dp"
        android:background="@color/white"
        android:orientation="vertical" &gt;

        &lt;TextView
            android:id="@+id/ad_txt_titel"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="35dp"
            android:layout_marginTop="0dp"
            android:background="@color/white"
            android:maxLines="2"
            android:textColor="@color/black"
            android:textStyle="bold" &gt;
        &lt;/TextView&gt;

        &lt;TextView
            android:id="@+id/ad_txt_text"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="5dp"
            android:layout_marginTop="18dp"
            android:background="@color/white"
            android:textColor="@color/black" &gt;
        &lt;/TextView&gt;

        &lt;WebView
            android:id="@+id/ad_web_html"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="0dp"
            android:layout_marginRight="12dp"
            android:layout_marginTop="18dp"
            android:background="@color/white"
            android:clickable="false" &gt;
        &lt;/WebView&gt;

        &lt;!-- Thema --&gt;

        &lt;LinearLayout
            android:id="@+id/ad_ll_thema"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="18dp"
            android:background="@color/white"
            android:orientation="horizontal" &gt;

            &lt;TextView
                android:id="@+id/ad_txt_thema_label"
                android:layout_width="120dp"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_marginLeft="5dp"
                android:layout_marginTop="0dp"
                android:background="@color/white"
                android:text="@string/artikeldetail_thema"
                android:textColor="@color/black" &gt;
            &lt;/TextView&gt;

            &lt;TextView
                android:id="@+id/ad_txt_thema"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_marginLeft="0dp"
                android:layout_marginTop="0dp"
                android:layout_marginRight="12dp"
                android:background="@color/white"
                android:textColor="@color/black" &gt;
            &lt;/TextView&gt;
        &lt;/LinearLayout&gt;

        &lt;!-- Suchbegriff --&gt;

        &lt;LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/ad_ll_suchbegriff"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="4dp"
            android:background="@color/white"
            android:orientation="horizontal" &gt;

            &lt;TextView
                android:id="@+id/ad_txt_suchbegriff_label"
                android:layout_width="120dp"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_marginLeft="5dp"
                android:layout_marginTop="0dp"
                android:background="@color/white"
                android:text="@string/artikeldetail_suchbegriff"
                android:textColor="@color/black" &gt;
            &lt;/TextView&gt;

            &lt;TextView
                android:id="@+id/ad_txt_suchbegriff"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_marginLeft="0dp"
                android:layout_marginRight="12dp"
                android:background="@color/white"
                android:layout_marginTop="0dp"
                android:textColor="@color/black" &gt;
            &lt;/TextView&gt;
        &lt;/LinearLayout&gt;

        &lt;!-- Liefer &amp; Ausgabedatum --&gt;

        &lt;LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/ad_ll_lieferdatum"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="18dp"
            android:background="@color/white"
            android:orientation="horizontal" &gt;

            &lt;TextView
                android:id="@+id/ad_txt_lieferung"
                android:layout_width="120dp"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_marginLeft="5dp"
                android:layout_marginTop="0dp"
                android:background="@color/white"
                android:text="@string/artikeldetail_lieferdatumlieferung"
                android:textColor="@color/black" &gt;
            &lt;/TextView&gt;

            &lt;TextView
                android:id="@+id/ad_txt_lieferung_datum"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_marginLeft="0dp"
                android:layout_marginTop="0dp"
                android:layout_marginRight="12dp"
                android:background="@color/white"
                android:textColor="@color/black" &gt;
            &lt;/TextView&gt;
        &lt;/LinearLayout&gt;

        &lt;LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/ad_ll_ausgabedatum"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="4dp"
            android:background="@color/white"
            android:orientation="horizontal" &gt;

            &lt;TextView
                android:id="@+id/ad_txt_ausgabe"
                android:layout_width="120dp"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_marginLeft="5dp"
                android:background="@color/white"
                android:layout_marginTop="0dp"
                android:text="@string/artikeldetail_ausgabedatum"
                android:textColor="@color/black" &gt;
            &lt;/TextView&gt;

            &lt;TextView
                android:id="@+id/ad_txt_ausgabe_datum"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@color/white"
                android:layout_alignParentLeft="true"
                android:layout_marginLeft="0dp"
                android:layout_marginTop="0dp"
                android:layout_marginRight="12dp"
                android:textColor="@color/black" &gt;
            &lt;/TextView&gt;
        &lt;/LinearLayout&gt;

        &lt;LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/ad_ll_medienart"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="18dp"
            android:background="@color/white"
            android:orientation="horizontal" &gt;

            &lt;TextView
                android:id="@+id/ad_txt_lieferung"
                android:layout_width="120dp"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:background="@color/white"
                android:layout_marginLeft="5dp"
                android:layout_marginTop="0dp"
                android:text="@string/artikeldetail_medienart"
                android:textColor="@color/black" &gt;
            &lt;/TextView&gt;

            &lt;TextView
                android:id="@+id/ad_txt_medienart"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@color/white"
                android:layout_alignParentLeft="true"
                android:layout_marginLeft="0dp"
                android:layout_marginTop="0dp"
                android:layout_marginRight="12dp"
                android:textColor="@color/black" &gt;
            &lt;/TextView&gt;
        &lt;/LinearLayout&gt;

        &lt;LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/ad_ll_medientyp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="4dp"
            android:background="@color/white"
            android:orientation="horizontal" &gt;

            &lt;TextView
                android:id="@+id/ad_txt_ausgabe"
                android:layout_width="120dp"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:background="@color/white"
                android:layout_marginLeft="5dp"
                android:layout_marginTop="0dp"
                android:text="@string/artikeldetail_medietyp"
                android:textColor="@color/black" &gt;
            &lt;/TextView&gt;

            &lt;TextView
                android:id="@+id/ad_txt_medietyp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@color/white"
                android:layout_alignParentLeft="true"
                android:layout_marginLeft="0dp"
                android:layout_marginTop="0dp"
                android:layout_marginRight="12dp"
                android:textColor="@color/black" &gt;
            &lt;/TextView&gt;
        &lt;/LinearLayout&gt;

        &lt;LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/ad_ll_kategorien"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="18dp"
            android:background="@color/white"
            android:orientation="horizontal" &gt;

            &lt;TextView
                android:id="@+id/ad_txt_kategorien_label"
                android:layout_width="120dp"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:background="@color/white"
                android:layout_marginLeft="5dp"
                android:layout_marginTop="0dp"
                android:text="@string/artikeldetail_kategorien"
                android:textColor="@color/black" &gt;
            &lt;/TextView&gt;

            &lt;TextView
                android:id="@+id/ad_txt_kategorien"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@color/white"
                android:layout_alignParentLeft="true"
                android:layout_marginLeft="0dp"
                android:layout_marginTop="0dp"
                android:layout_marginRight="12dp"
                android:textColor="@color/black" &gt;
            &lt;/TextView&gt;
        &lt;/LinearLayout&gt;
    &lt;/LinearLayout&gt;
&lt;/RelativeLayout&gt;
&lt;/ScrollView&gt;
</code></pre>

<p>Link to combines screenshots of complex activity with incorrect grey background (left), correct white background (right site): <a href="http://int.argus.ch/screenshots.jpg" rel="nofollow">http://int.argus.ch/screenshots.jpg</a></p>

<p>Link to video which demonstrates that changing orientation lead to the problem (in another activity)(Quite big 50MB): <a href="http://int.argus.ch/grey.mp4" rel="nofollow">http://int.argus.ch/grey.mp4</a></p>

<p>I can't post the link to the simple activity screenshot here because I am a newbie, but the background color of the LinearLayout is no longer white, but also grey.</p>

<p><strong>PS: I changed the @white definition the blue. Everything blue. If the problem occours, everything is also grey, not different blue colors!</strong></p>

<p>Many thanks in advance</p>
