Sunday, September 29, 2013

Reference to resources in XML files

In your XML files, for example your layout files, you can refer to other resources via the @ sign.
For example, if you want to refer to a color which is defined in an XML resource, you can refer to it via @color/your_id. Or if you defined a "hello" string in an XML resource, you could access it via @string/hello.
To use an Android system resource, include the android namespace into the references, e.g. android.R.string.cancel.

No comments:

Post a Comment