在根元素后的文档中的标记必须格局良好? [英] The markup in the document following the root element must be well-formed?

查看:165
本文介绍了在根元素后的文档中的标记必须格局良好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在第9行的activity_main.xml中收到此错误,我不知道为什么请帮忙。

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>


推荐答案

如果你会google这个错误,有很多的帖子相同。
例如:

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

Android应用程序,根元素后面的文档中的标记必须格式良好

在根元素后的文档中的标记必须格局正确。这是什么原因?

错误:根元素后面的文档中的标记必须格式良好请帮助我在Android中新增

等等。
基本上它表示您只能为整个XML 文件只有一个根元素。您显示的xml sniplet看起来不完整。只要确保你只有一个根元素的XML文件,其余的是该根元素的子元素。希望这可以帮助。如果没有,请为我们发布完整的XML文件以帮助更好。

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.

更新

在上面显示的代码中,您有两个 FrameLayout 根元素。应该只有一个。因此,根据您的需要将其更改为如下所示,以便只有一个根元素:

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>

这篇关于在根元素后的文档中的标记必须格局良好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆