I’m using Eclipse.
Problem: Code that references colors in my resource folder can’t be launched.
Example:
--><LinearLayout
`android:background="@color/background"` // I don't have the color directory. How do I get it. (that code refers to color in my project/res folder)
android:layout_height="fill_parent"
</LinearLayout>
As explained by L0rdAli3n and CommonsWare, there’s no default colors file available – you have to create your own. Same as you create layout to give an example.
Here’s an example:
There are currently three formats specified above which are supported. You can include this XML (without the resources tag) in Strings.xml which is in you res/values/ folder. And can straight away use them
with @[:packagename]color/[colorname]Alternatively you can create a colors.xml file in you res/values/ folder and use same as above, this is recommended and best practiced approach.