Android应用程序背景颜色未设置

EM-*_*ons 5 java android

我最近开始开发 Android 应用程序。我不是一个编程菜鸟,我从 2009 年就开始使用 Java 编程,但这是我的第一个 Android 应用程序。我尝试遵循一些有关如何设置背景颜色的教程,但它对我来说根本不起作用。我无法弄清楚我做错了什么。

在我的布局目录中,我有名为:main.xml 和 view_fact.xml 的文件。它们都使用线性布局,我的 LinearLayout 标签如下:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/background_grey"
>
Run Code Online (Sandbox Code Playgroud)

在我的“values”目录中,“strings.xml”的内容是:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Facts</string>
<color name="background_grey">#E8E8E8</color>
</resources>
Run Code Online (Sandbox Code Playgroud)

但背景颜色并没有改变默认的黑色。

我还尝试在 AndroidManifest.xml 文件中添加:“android:theme="@android:style/Theme.Light"”。

这些都不起作用,有什么建议吗?

谢谢。

在我的 view_fact.xml 页面上,它看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/background_grey"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Fact:"
android:padding="10dp"
android:textColor="#080808"
/>

<TextView 
android:id="@+id/factData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text=""
/>
<Button
android:id="@+id/anotherFactButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Another Fact"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

有趣的是,“factData”中的文本是灰色的,而上面文本视图中的文本:“Fact:”是白色的,我尝试将其颜色更改为红色,但不起作用。它保持白色。

有什么建议么?我还没有设法让这个工作;谢谢。

EM-*_*ons -1

好吧,我尝试了很多不同的方法来尝试设置背景颜色,但没有一个起作用。我现在遇到文本无法更新的问题。所以我要尝试重新制作它。使用 eclipse,如果我仍然遇到问题,我会提出一个新问题。感谢您的建议。