My first app. Error: Invalid LinearLayout start tag. What for?

It worked fine, but then I made some minor changes, and now it does not work ... Here is the main layout of the xml file ... It gives an error on line 3.

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:layout_width="0dip" android:layout_height="fill_parent" android:orientation="vertical" android:layout_weight="6"> <TextView android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="2" android:background="#FFFF00" android:text="@string/yellow" android:textColor="#FFFFFF" android:gravity="center_horizontal" /> <TextView android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:background="#FFFFFF" android:text="@string/helo" android:textColor="#000000" android:gravity="center_horizontal" /> <TextView android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:background="#FFFF00" android:text="@string/yellow" android:textColor="#FFFFFF" android:gravity="center_horizontal" /> </LinearLayout> <LinearLayout android:layout_width="0dip" android:layout_height="fill_parent" android:orientation="vertical" android:layout_weight="4"> <TextView android:layout_width="fill_parent" android:layout_height="0dip" android:text="@string/blue" android:layout_weight="3" android:textColor="#FFFFFF" android:background="#0000FF" /> <TextView android:background="#FFFFFF" android:text="@string/helo" android:layout_width="fill_parent" android:layout_height="0dip" android:textColor="#000000" android:layout_weight="1" /> <TextView android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:textColor="#FFFFFF" android:text="@string/yellow" android:background="#FFFF00" /> <TextView android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:text="@string/blue" android:background="#0000FF" android:textColor="#FFFFFF" /> </LinearLayout> </LinearLayout> 
+7
source share
2 answers

I think you have a file in the wrong directory. The layout file should be in the res/layout/ directory in your project. I assume you have this in some other res/ directory.

+31
source

Try the @CommonsWare offer. If this does not work, try deleting the error messages in Eclipse. (for example, right-click and select delete.) I often find that I fix the problem in XML layouts, but the ID environment does not notice and continues to report an error that prevents me from compiling. In this case, you can simply delete the error message. If this does not work, try a clean build.

+1
source

All Articles