什么是默认布局背景

时间:2013-01-24 17:39:09

标签: android html android-layout background-color

我有一个WebView,它加载带有文本的HTML文件。问题是html和外部的颜色不一样。这是一个截图:

The Activity With the WebView

HTML FIle是:

<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>

(如果我删除:bgcolor="#FFFFFF"颜色保持不变) 谢谢!

6 个答案:

答案 0 :(得分:125)

灯光主题的默认背景颜色为:#EEEEEE

几乎是白色,但不完全。

它对我有用,希望它为你工作。

更新:在新版本中,您可能正在寻找#FAFAFA

答案 1 :(得分:64)

您可以通过引用来使用主题的默认背景颜色:

?android:colorBackground

答案 2 :(得分:23)

要更改背景(如果这实际上是您要执行的操作):

style.xml中的

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

并在你的清单中

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

答案 3 :(得分:13)

转到清单

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

您看到主题是MyMaterialTheme.NoActionBar

所以去res - &gt;值 - &gt;款式 Click open in editor

Click on the pallette for the background color

This is your background color

所以对我来说默认是#FFFAFAFA

当我提出建议的颜色#EEEEEE或#FAFAFA时,它适用于某些手机,而其他手机则关闭了,所以这就是我通过反复试验找到的

答案 4 :(得分:2)

默认颜色为黑色。

如果您使用样式,请转到“values / styles.xml”并找到您的解决方案。现在你可以查看bg颜色了。 关于主题和样式:http://developer.android.com/guide/topics/ui/themes.html

编辑:

布局背景颜色变化 - Setting background colour of Android layout element

编辑2:

如果在styles.xml中是@android:style / Theme.Light你的bg颜色是白色。

答案 5 :(得分:0)

浅色主题的默认背景颜色是:#e6FFFFFF

相关问题