0

I am a beginner coder trying to learn how to make android apps. I am using these tutorials and I guess I have ran into an error.

Here is my text.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="25dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<EditText
android:id="@+id/etCommands"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Type a command"
android:password="true" />

<LinearLayout
android:weightSum="100"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" 

<Button
    android:layout_weight="20"
    android:id="@+id/Bresults"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Button" /> 



<ToggleButton
android:layout_weight="80"
android:id="@+id/tbPassword"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="ToggleButton"
android:checked="true" />

</LinearLayout>

<TextView
android:id="@+id/tvresults"
android:paddingBottom="10dp"
android:checked="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="invalid" />

</LinearLayout>

I am getting an error next to where it says button. The error says:

Multiple annotations found at this line: - Element type "LinearLayout" must be followed by either attribute specifications, ">" or "/>". - error:error parsing XML:not well-formed (invalid token)"

3 Answers 3

1

You need to close the tag on your second Linear Layout >

<LinearLayout
android:weightSum="100"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"> <!-- here -->
Sign up to request clarification or add additional context in comments.

Comments

0

The colorcoding in your post already highlights the issue. You forgot the > after the LinearLayout opening tag.

2 Comments

Looking at the colors always helps. In this case, they simply turned black.
yea, i see it now. the eclipse software didnt make it turn black. ty for the quick reply though.
0

The IDE is complaining that your xml is not well-formed. If the IDE's errors are not clear enough, you try an online validator such as http://www.xmlvalidation.com/ .

Comments

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.