@ in AndroidManifest.xml file

android, xml

Solution

In this case:

android:layout_width="fill_parent"

the value for the attribute, `android:layout_width`, is specified directly inside the quotes, `fill_parent`. In the other case:

android:text="@string/hello"

the value for the attribute, `android:text="@string/hello"`, is specified elsewhere. This is indicated by the `@` at the beginning of the string. In this example it is `@string/hello`. The value is in a resource.

From the "Resource values" section in The AndroidManifest.xml File from the Android Developers site. Found from link in allclaws answer.

Resource values are expressed in the following format,

@[package:]type:name

where the package name can be omitted if the resource is in the same package as the application, type is a type of resource — such as "string" or "drawable" — and name is the name that identifies the specific resource.

Problem

From the O'Reilly book "Android Application Development " by Rick Rogers, John Lombardo, Zigurd Mednieks & Blake Meike, page 23: ``` <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> ``` From page 44: ``` <application android:icon="@drawable/icon2"> ``` What is the meaning of the `@` in each of the above fragments?

Original source