What is the default layout background

AndroidHtmlAndroid LayoutBackground Color

Android Problem Overview


I got a WebView that load an HTML file with a text. The problem is that the color inside the html and outside isn't the same. Here is a screenshot:

The Activity With the WebView

The HTML FIle is:

<html dir="rtl">
<head>
    <title>About</title>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>

    <body bgcolor="#FFFFFF">
        <p>This is a Testpp</p>
        <p>See the problem.</p>
         <p>last test:</p>
    </body>
</html>

(If I remove the: bgcolor="#FFFFFF" color stays the same) Thanks!

Android Solutions


Solution 1 - Android

The default background color for light theme is: #EEEEEE

Is almost white, but not completely.

It worked for me, hope its work for you.

UPDATE: In new versions you could be looking for #FAFAFA

Solution 2 - Android

You can use your theme's default background color by referencing:

?android:colorBackground

Solution 3 - Android

To change your background (if this is in fact what you are looking to do):

in styles.xml

<style name = "MyDefaultStyle" parent = "@android:style/Theme">
	<item name = "android:windowBackground">@drawable/default_drawable_bg</item>
</style>

and in your manifest

<application
    android:name="MyApp"
    android:theme="@style/MyDefaultStyle" >

Solution 4 - Android

Go to Manifest

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/MyMaterialTheme.NoActionBar">

You see the Theme is MyMaterialTheme.NoActionBar

So go to res -> values -> styles Click open in editor

Click on the pallette for the background color

This is your background color

So for me the default is #FFFAFAFA

When i put the suggested colors #EEEEEE or #FAFAFA, it worked on some phones, and on other phones it was off, so that's what I found with trial and error

Solution 5 - Android

Default color is black.

If you use style, go to "values/styles.xml" and there is solution of you issue. Now you can check bg color. About themes and styles : http://developer.android.com/guide/topics/ui/themes.html

EDIT :

Layout background color changing - https://stackoverflow.com/questions/7378636/setting-background-colour-of-android-layout-element

EDIT 2:

If in styles.xml is @android:style/Theme.Light your bg color is white.

Solution 6 - Android

The default background color for light theme is: #e6FFFFFF

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionelichai2View Question on Stackoverflow
Solution 1 - AndroidcutikoView Answer on Stackoverflow
Solution 2 - AndroidCristanView Answer on Stackoverflow
Solution 3 - AndroidinvertigoView Answer on Stackoverflow
Solution 4 - AndroidJaad ChacraView Answer on Stackoverflow
Solution 5 - AndroidTN888View Answer on Stackoverflow
Solution 6 - AndroidJulio RahmanView Answer on Stackoverflow