gpt4 book ai didi

java - Eclipse 错误“文档中跟随根元素的标记必须格式正确

转载 作者:行者123 更新时间:2023-11-29 03:29:05 25 4
gpt4 key购买 nike

所以今天我开始按照这个视频构建我的第一个 Android 应用程序:http://www.youtube.com/watch?v=U5Qi0lb_3nE

视频进行了大约一半后,我收到错误消息“根元素后面的文档中的标记必须格式正确”

我看不出问题所在,所以这是我的代码:

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

视频中我卡住的位置大约是播放 9 分钟。

抱歉没有具体说明,我以前从未使用过 Stockover。

感谢大家的帮助!

最佳答案

您在 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">

关于java - Eclipse 错误“文档中跟随根元素的标记必须格式正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19329066/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com