android - 解析 XML 时出错 : not well-formed (invalid token) andElement type "LinearLayout" must be followed by either attribute specifications, ">"或 "/>"

标签 android xml

<分区>

<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/editmessage"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:hint="@string/edit_message"
<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_conent"
    android:text="@string/button_send"/>

<?xml version"1.0" encoding="utf-8"?>

<rescources>
    <string android:name="app_name">becreativebuddy</string>
    <string android:name="edit_message">Enter a message</string>
    <string android:name="button_send">Send</string>
    <string android:name="action_settings">Settings</string>
    <string android:name="title_activity_main">MainActivity</string>
</rescources>


</LinearLayout>

我在第 7 行的标题中遇到了这两个错误。我不知道为什么它告诉我我有一个想法,因为我只是在学习,所以请保持友善。

最佳答案

这些 View 在这里

<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/editmessage"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:hint="@string/edit_message"

需要关闭。每个 View 都需要在某个时候用 /> 关闭。 LinearLayout 是一个根 View,所以它在最后用

关闭
</LinearLayout>

所以它只需要在顶部有一个>

<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 已准备好关闭,因为您已完成向其添加属性,因此请添加 />

<EditText android:id="@+id/editmessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/edit_message"/>

关于android - 解析 XML 时出错 : not well-formed (invalid token) andElement type "LinearLayout" must be followed by either attribute specifications, ">"或 "/>",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16631004/

相关文章:

java - 如何使用一组代码拥有多个微调器

android - 使用约束布局无法将 TextView 放置在指南下方

Android:显示来自 Theme.Light Activity 的对话框的问题

java - 布局顶部的 Admob 横幅

xml - 如何使用冒号解码 xml 元素

android - 按钮文本未在按钮中垂直居中

c# - 如何将 List<String> 转换为 xml 文档?

android - Android 版本 < 6.0 中的文本椭圆大小行为

android - RecyclerView 项目之间的差距很大

sql-server - 从 SQL Server 中的 XML 列中提取所有属性值