Android XML文件中出错:中止生成
我是新的android开发人员。我正在创建一个带有几个按钮的屏幕,但当运行它时,我得到以下错误。这意味着什么?我如何避免 XML文件中出错:中止生成 文档中根元素后面的标记必须格式正确Android XML文件中出错:中止生成,android,xml,file,build,abort,Android,Xml,File,Build,Abort,我是新的android开发人员。我正在创建一个带有几个按钮的屏幕,但当运行它时,我得到以下错误。这意味着什么?我如何避免 XML文件中出错:中止生成 文档中根元素后面的标记必须格式正确 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/frontpagelay
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/frontpagelayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/lg"/>
<Button
android:id="@+id/uyounadults"
android:layout_width="200dp"
android:layout_height="40dp"
android:layout_below="@+id/umusicfan"
android:layout_centerHorizontal="true"
android:layout_marginTop="19dp"
android:text="@string/uyoungadults" />
<Button
android:id="@+id/umusicfan"
android:layout_width="200dp"
android:layout_height="40dp"
android:layout_below="@+id/ushop"
android:layout_centerHorizontal="true"
android:layout_marginTop="19dp"
android:text="@string/umusicfan" />
<Button
android:id="@+id/utourist"
android:layout_width="200dp"
android:layout_height="40dp"
android:layout_below="@+id/ufamily"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:text="@string/utourist" />
<Button
android:id="@+id/ufamily"
android:layout_width="200dp"
android:layout_height="40dp"
android:layout_below="@+id/uyounadults"
android:layout_centerHorizontal="true"
android:layout_marginTop="26dp"
android:text="@string/ufamily" />
<Button
android:id="@+id/ustudent"
android:layout_width="200dp"
android:layout_height="40dp"
android:layout_below="@+id/utourist"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp"
android:text="@string/ustudent" />
<Button
android:id="@+id/ushop"
android:layout_width="200dp"
android:layout_height="40dp"
android:layout_alignLeft="@+id/umusicfan"
android:layout_alignParentTop="true"
android:layout_marginTop="96dp"
android:text="@string/ushop" />
<TextView
android:id="@+id/welcome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="18dp"
android:layout_marginTop="16dp"
android:text="@string/welcome"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/selection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/welcome"
android:layout_below="@+id/welcome"
android:layout_marginTop="15dp"
android:text="@string/selection"
android:textAppearance="?android:attr/textAppearanceSmall" />
您缺少xml中的第一行:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/frontpagelayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/lg">
stuff here
</RelativeLayout>
这里的东西
您缺少xml中的第一行:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/frontpagelayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/lg">
stuff here
</RelativeLayout>
这里的东西
如果要关闭相对布局,则必须关闭文档的该端,如下所示:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/frontpagelayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/lg">
<Button
android:id="@+id/uyounadults"
android:layout_width="200dp"
android:layout_height="40dp"
android:layout_below="@+id/umusicfan"
android:layout_centerHorizontal="true"
android:layout_marginTop="19dp"
android:text="@string/uyoungadults" />
//You can add another views here
</RelativeLayout >
//您可以在此处添加其他视图
如果要关闭相对布局,则必须关闭文档的该端,如下所示:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/frontpagelayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/lg">
<Button
android:id="@+id/uyounadults"
android:layout_width="200dp"
android:layout_height="40dp"
android:layout_below="@+id/umusicfan"
android:layout_centerHorizontal="true"
android:layout_marginTop="19dp"
android:text="@string/uyoungadults" />
//You can add another views here
</RelativeLayout >
//您可以在此处添加其他视图
RelativeLayout标记未正确关闭RelativeLayout标记未正确关闭我很抱歉,我刚刚接触android应用程序,我应该把它确切地放在哪里?放在xml的第一行。好的,我已经把那行放在那里了,它仍然会给我同样的错误我很抱歉,我刚接触android应用程序,我在哪里应该把它放在xml的第一行吗?好的,我已经把那一行放在那里了,它仍然会给我同样的错误