android - Android Studio 错误格式不正确(无效令牌)
问题描述
我正在为我的父母商店制作一个具有网络应用商店的应用。当我制作导航抽屉时(据我所知它是正确的)但它给了我一个错误:AAPT:错误:格式不正确(无效令牌)但据我所知,我输入的所有内容都是正确的并且没有使用错误的令牌。完整的错误是:AndroidStudioProjects\Pws\app\src\main\res\layout\activity_main.xml:19: AAPT: error: not well-formed (invalid token)。
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
<include
layout="@layout/main_toolbar"/>
<RelativeLayout
android:layout_width="300dp"
android:layout_height="match_parent"
android:background="@color/achtergrond">
错误应该在 <include ..... 但我想不出这里的问题。我应该使用什么不同的令牌?或者我做错了什么?
感谢您的阅读,我希望你们中的一些人可以帮助我。
解决方案
你忘了关闭LinearLayout
标签。
它应该是这样的:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" />
<include
layout="@layout/main_toolbar"/>
或像这样:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<include
layout="@layout/main_toolbar"/>
</LinearLayout>
取决于你想要达到的目标
推荐阅读
- python - 熊猫仅针对正值和其他条件计算/显示数据帧 cumsum()
- php - 合并多个 github 用户帐户并传输提交
- c# - .Net 5.0 中的 Endpoint.Behaviors 和 clientRuntime.MessageInspectors 在哪里?
- reactjs - 在 redux 中,在行动中更改数据是一种好的做法吗?
- django - 模型管理错误:无法排除字段,因为它是父模型的外键
- plotly - plotly:从直方图中获取值 / plotly:从轨迹中获取值
- java - 我如何在 Springboot 中为 Thread shedule 命名
- javascript - 从安全角度来看,让第三方将整个 HTML 注入 iframe 是否可以?
- javascript - 谷歌图表时间线 - 图像作为标签
- ios - 如何在没有 segues 的情况下转到另一个视图控制器 [SWIFT 5]