0

Im getting this error in my activity_main.xml on line 9 by I have no idea why please help.

<FrameLayout
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1" >

<WebView
    android:id="@+id/webView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />
</FrameLayout>
Andreas Fester
  • 36,091
  • 7
  • 95
  • 123
user2577676
  • 3
  • 1
  • 1
  • 3

2 Answers2

3

Try ctrl + shift + F to your xml code which will format the code and try again after cleaning the project.it will work.

Yuva Raj
  • 3,881
  • 1
  • 19
  • 30
0

If you would have googled this error, there are lots of post for the same. Eg:

Android app, The markup in the document following the root element must be well-formed

The markup in the document following the root element must be well-formed. What is the cause of this?

Error : The markup in the document following the root element must be well-formed Please help I am new at android

and so on. Basically it says that you can only have one root element for the whole XML file. The xml sniplet you've shown does not look complete. Just make sure that you only have one root element for the XML file and rest of them are child of that root element. Hope this helps. If it doesn't then please do post the complete XML file for us to help better.

Update

In the code shown above you have two FrameLayout root elements. There should be only one. So change it(based on your needs) to something like below, so that only one root element is there:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/fullscreen_custom_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#FF000000">
    <FrameLayout
        android:id="@+id/main_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
    <WebView
        android:id="@+id/webView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

</FrameLayout>
Community
  • 1
  • 1
Shobhit Puri
  • 25,769
  • 11
  • 95
  • 124