Java Eclipse 错误“文档中根元素后面的标记必须格式正确
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19329066/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse error "The markup in the document following the root element must be well-formed
提问by user2872834
So today I started to build my first android app following this video: http://www.youtube.com/watch?v=U5Qi0lb_3nE
所以今天我开始按照这个视频构建我的第一个 android 应用程序:http: //www.youtube.com/watch?v=U5Qi0lb_3nE
After doing about half of the video I got an error "The markup in the document following the root element must be well-formed"
在完成大约一半的视频后,我收到一个错误“根元素后面的文档中的标记必须格式正确”
I cant see the problem, so here is the code I have:
我看不到问题,所以这是我的代码:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:ignore="MergeRootFrame" />
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello!" />
<TextView android:id="@+id/text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="This is my first android application!" />
<Button android:id="@+id/button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text ="And this is a Clickable button!!!" />
</FrameLayout>
The spot In the video I got stuck at was about 9 minutes into it.
在视频中我被卡住的地方是大约 9 分钟。
Sorry for not being to specific, I've never used Stockover before.
抱歉没有具体说明,我以前从未使用过 Stockover。
Thanks for all the help!
感谢所有的帮助!
采纳答案by ashatte
You have more than one root elements in the XML document, and there can only be one. You need to change the final />
to >
in the first element (FrameLayout):
XML 文档中有多个根元素,并且只能有一个. 您需要将最终改变/>
到>
第一个元素(FrameLayout里):
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:ignore="MergeRootFrame">