2013-07-12 26 views
0

我在第9行的activity_main.xml中得到這個錯誤,我不知道爲什麼請幫助。 根元素之後的文檔中的標記必須是格式良好的?

<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> 
+0

這是您的'activity_main.xml'的整個內容嗎? –

回答

0

如果你想了這個錯誤,有很多相同的帖子。 如:

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

等。 基本上它說你只能有整個XML文件的一個根元素。您顯示的xml sniplet看起來並不完整。只要確保您只有一個XML文件的根元素,其餘的元素就是該根元素的子元素。希望這可以幫助。如果沒有,那麼請發佈完整的XML文件,以便我們更好地提供幫助。

更新

在上述你所示的代碼有兩個FrameLayout根元素。應該只有一個。因此,根據您的需要將其改爲如下所示,以便只有一個根元素:

<?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> 
+0

完美謝謝。我認爲其他答案幫助了我,但保存之後給出了同樣的錯誤。但是這樣做了。 – user2577676

+0

很高興幫助。根據您的需要管理您的XML。保持ind只有一個根元素。 –

3

嘗試ctrl + shift + F你的XML代碼,將設置代碼的格式和清潔project.it將工作後再試。

+0

@ user2577676繼續:) –

相關問題