No resource found error in layout xml file android

android, layout, resources, xml

Solution

You should use the `@+id/tRowMain` syntax in the first place the ID is used, not necessarily the first place where you define it as the ID of the element.

Change:

`android:layout_above="@id/tRowMain"` to `android:layout_above="@+id/tRowMain"`

and

`android:id="@+id/tRowMain"` to `android:id="@id/tRowMain`

In other words, when deciding whether or not to use `@+id` or `@id`, it doesn't matter which attribute you're assigning the id to. Always use `@+id` the first time you mention your ID in the XML.

Problem

I get this error in xml file very often. here is the code in xml file ``` <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal" android:layout_centerHorizontal="true" android:layout_above="@id/tRowMain" // in this line i get error resource not found that matches given name android:textColor="@color/selectLevel" android:id="@+id/tvOnOption" android:text="Select Mode" /> <TableRow android:layout_width="fill_parent" android:id="@+id/tRowMain" android:layout_height="wrap_content" android:gravity="center" android:layout_centerVertical="true" android:layout_centerHorizontal="true" > ``` //then i checked in R.java file and the id for this name is there ``` public static final class id { public static final int ibtn_retry=0x7f060006; public static final int rLayoutMain=0x7f060000; public static final int tRowMain=0x7f060002; } ``` please help me figure out whats wrong with this... thanks

Original source