Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Xml格式错误_Android_Xml - Fatal编程技术网

Android Xml格式错误

Android Xml格式错误,android,xml,Android,Xml,好的,我刚刚开始学习如何开发一个应用程序,我正在做正确的事情,我希望通过看一看并学习android本身。我花了一段时间在网络上四处寻找,但在本世纪初未能找到一个问题的答案 然而,我甚至不能通过第三部分的教训,因为它不断出现错误 以下是我的代码供参考: 主要活动 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/too

好的,我刚刚开始学习如何开发一个应用程序,我正在做正确的事情,我希望通过看一看并学习android本身。我花了一段时间在网络上四处寻找,但在本世纪初未能找到一个问题的答案

然而,我甚至不能通过第三部分的教训,因为它不断出现错误

以下是我的代码供参考:

主要活动

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
    <EditText 
        android:id="@+id/edit_message"
        android:layout_weight="1"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:hint="@string/edit_message"
        android:inputType="text" />
    <Button 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/button_send" />
</LinearLayout>
和strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">My First App</string>
    <string name="action_settings">Settings</string>
    <string name="edit_message">Enter a message</string>
    <string name="button_send">Send</string>
</resources>
im获取的具体错误是:错误:解析XML时出错:格式不正确无效的令牌活动\u main.XML/MyFirstApp/res/layout line 6 Android AAPT问题

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" > <!-- you forgot this ">" -->
<EditText 
    android:id="@+id/edit_message"
    android:layout_weight="1"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:hint="@string/edit_message"
    android:inputType="text" />
<Button 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/button_send" />
</LinearLayout>  
解析XML时出错意味着XML文件中存在错误 格式不好您的文件的构建有问题 activity_main.xml哪个xml /MyFirstApp/res/layout在我的软件包中的位置 第六行你什么都知道

希望这有帮助。

更改此选项:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
为此:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >

您没有关闭xml中的第一项:LinearLayout您不应该使用单词delayed。这是我们的基本问题。。。在开始android开发之前,我们需要学习xml和java。如果一个人不知道如何使用剑和盾,他就不可能赢得战争。我已经尝试过关闭声明,但是没有在声明后空格,因为某种原因,这给了我一大堆错误:S为帮助喝彩,尽管你所要做的只是复制和粘贴代码。不知怎的,你把它复制错了,你想知道为什么它不起作用?