【问题标题】:Error:(3) error: not well-formed (invalid token)错误:(3)错误:格式不正确(无效令牌)
【发布时间】:2018-02-11 18:13:42
【问题描述】:

我正在处理我的应用程序,但遇到了错误。我已将所有图片上传到可绘制文件夹中。

错误:(3) 错误:格式不正确(无效令牌)。

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/Profile"android:title="Profile" android:icon="@drawable/ic_person_black_24dp" />
    <item android:id="@+id/TradingHistory"android:title="TradingHistory" android:icon="@drawable/ic_history_black_24dp" />
    <item android:id="@+id/News"android:title="News" android:icon="@drawable/ic_view_list_black_24dp" />
</menu>

这是什么意思,我该如何解决?

【问题讨论】:

  • android:id 和 android:title 之间有一个空格?例如 android:id="@+id/Profile" android:title="Profile"

标签: android xml android-layout


【解决方案1】:

错误表示第 3rd 行格式不正确:您需要在 android:id 值和 android:title 之间有一个 空格)键。

这是正确的 XML:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/Profile" android:title="Profile" android:icon="@drawable/ic_person_black_24dp" />
    <item android:id="@+id/TradingHistory" android:title="TradingHistory" android:icon="@drawable/ic_history_black_24dp" />
    <item android:id="@+id/News" android:title="News" android:icon="@drawable/ic_view_list_black_24dp" />
</menu>

【讨论】:

    【解决方案2】:

    转到工具栏中的代码并单击重新格式化代码。

    【讨论】:

      猜你喜欢
      • 2018-09-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-27
      • 1970-01-01
      • 2021-05-08
      • 2011-04-28
      相关资源
      最近更新 更多