0

I am creating an Android app following a web tutorial. I am having an issue at this layout file, but I don't see the problem. The error shown is :

Element Type LinearLayout must be followed by either attribute specifications > or />.

Layout XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="10dp"
    android:paddingLeft="10dp"
    android:paddingRight="10dp" >
 
    <!-- Name Label -->
 
    <TextView
        android:id="@+id/name"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="2dip"
        android:paddingTop="6dip"
        android:textColor="#43bd00"
        android:textSize="16sp"
        android:textStyle="bold" />
 
    <!-- Email label -->
    <TextView
        android:id="@+id/email"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="2dip"
        android:textColor="#acacac" />
 
    <!-- Mobile number label -->
    <TextView
        android:id="@+id/mobile"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="left"
        android:text="Mobile: "
        android:textColor="#5d5d5d"
        android:textStyle="bold" />
 
</LinearLayout>

EDIT

enter image description here

4
  • Does the error persist if you clean the project? Commented Apr 7, 2014 at 17:37
  • @donfuxx, thank you for your comment. After cleaning the project, the error persists. Commented Apr 7, 2014 at 17:39
  • 1
    not very professional answer but try deleting your first line <?xml version="1.0" encoding="utf-8"?> and clean and build again Commented Apr 7, 2014 at 17:46
  • @Setu, I have done what you say, but the error persists. Commented Apr 7, 2014 at 17:48

1 Answer 1

1

I don't see any problem with the layout i even pasted it in my eclipse and it didn't give me any errors, you need to clean your project and then it will work fine, from the top navigation menu click on project then clean and choose your project folder.

Sign up to request clarification or add additional context in comments.

7 Comments

I know, but after cleaning the error persists. Please take a look at my edited question.
@mvasco Does your project has other errors than this one, sometimes layout errors fade away when you fix other errors. Also what version is your build target, right click and choose properties and then android.
You are right, the first problem was this one with my layout file, after cleaning the project, other errors have appeared, but I guess the main problem is still the xml file. The build target is Android 4.4.2, API level 19.
@mvasco clear other problems first, then this one will disappear.
If that is the only error then it comes from your layout file error, so my only suggestion which might sound dumb is to copy paste it into a new layout file and see if it works. It is working fine in my eclipse.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.