in android you want to seperate all your resources like Strings , colors , dimen(size of text), drawables etc. outside of your code , we do it to give our code more flexibility . for example
if you want to change the color of your red color in your app to light red you simply change it in your resources in one place and it affect your whole app...
when you open a project in android notice you have a res folder.
inside it you will find values folder.
stand on values folder and right click your button.
add an xml file and call it colors.
you can take a look at this site , it's a nice one:
http://www.rapidtables.com/web/color/RGB_Color.htm
you can pick a color you want and you will see it's value .for example #FFFFFF for white.
now you need to open the file you created and press ctrl+space and add a color.
it will be something like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="opaque_red">#FF0000</color>
</resources>
to get a color from your resource you can call it from your Activity like this:
write this in onCreate():
Recources res = getResources();
TextView tv = (TextView)findViewById(R.id.my_tv);
tv.setBackgroundResource(R.color.opaque_red);
or you can define it in your xml layout like this:
<?xml version="1.0" encoding="utf-8"?>
<EditText xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="@color/opaque_red"
android:text="@string/hello" />
hope it answered your question...