xml - Cores

Top  Previous  Next

Tela

 

 

/res/values/cores.xml

 
<?xml version="1.0" encoding="utf-8"?>

<resources>

  <color name="vermelho">#ff0000</color>

  <color name="azul">#0000ff</color>

  <color name="verde">#00ff00</color>

  <color name="branco">#ffffff</color>    

</resources>
 

layout.xml

 
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

  android:layout_width="fill_parent"

  android:layout_height="fill_parent"

  android:orientation="vertical" >

 

  <TextView

      android:layout_width="wrap_content"

      android:layout_height="wrap_content"

      android:background="@color/azul"

      android:text="Large Text"

      android:textAppearance="?android:attr/textAppearanceLarge"

      android:textColor="@color/branco" />

 

  <TextView

      android:layout_width="wrap_content"

      android:layout_height="wrap_content"

      android:background="@color/branco"

      android:text="Large Text"

      android:textAppearance="?android:attr/textAppearanceLarge"

      android:textColor="@color/azul" />

 

  <TextView

      android:layout_width="wrap_content"

      android:layout_height="wrap_content"

       android:background="@color/verde"

      android:text="Large Text"

      android:textAppearance="?android:attr/textAppearanceLarge"

      android:textColor="@color/vermelho" />

 

  <TextView

      android:layout_width="wrap_content"

      android:layout_height="wrap_content"

      android:background="@color/vermelho"

      android:text="Large Text"

      android:textAppearance="?android:attr/textAppearanceLarge"

      android:textColor="@color/azul" />

 

</LinearLayout>