Android background color blue

Android-background-color-blue-featured.png

Using color in Android, by XML

In Android, colors could be defined directly, for example “#ff0000″ for red-colored. You may also produce a resource file under /res/values folder (with any file title), with your personal color id defined inside. Such that you could access them in Java code using id. Android also defined basics occur android.R.color.

example:

/res/values/mycolor.xml




#ff0000
#00ff00
#0000ff

/res/layout/primary.xml


android:orientation=”vertical”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
android:id=”@+id/background”
>

android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:text=”@string/hello”
/>


android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:text=”Whitened”
android:textColor=”@android:color/whitened”
android:id=”@+id/whitebutton”
/>


android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:text=”Red-colored”
android:textColor=”#ff0000″
android:id=”@+id/redbutton”
/>


android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:text=”Eco-friendly”
android:textColor=”@color/eco-friendly”
android:id=”@+id/greenbutton”
/>


android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:text=”BLUE”
android:textColor=”@color/blue”
android:id=”@+id/bluebutton”
/>

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>