androidcolorstextviewviewflipper

Black text appears grey in Android View


I'm using a ViewFlipper to alternate some different RelativeLayouts. My layout is very simple.

<RelativeLayout 
                android:id="@+id/display_info_layout"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical"
                android:background="#FFFFFF" >

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerHorizontal="true"
                    android:layout_marginLeft="25dp"
                    android:layout_marginRight="25dp"
                    android:layout_marginTop="20dp"
                    android:text="@string/information"
                    android:color="@color/black" />
            </RelativeLayout>  

THE PROBLEM: The color named "black" is defined in my resources as "#000000". The text elements appear the correct black color in other layouts, but in this one it appears a dull grey.

Other Layout Other layout with normal black text

This Layout This layout with grey text

THE QUESTIONS:

  1. What could be causing this?
  2. How do I fix it?

Solution

  • You should be using android:textColor I don't think android:color exists as an attribute

    So:

                     <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerHorizontal="true"
                        android:layout_marginLeft="25dp"
                        android:layout_marginRight="25dp"
                        android:layout_marginTop="20dp"
                        android:text="@string/information"
                        android:textColor="@color/black" />