在XML元素的开始和结束标记内部进行注释时,“标记开始未关闭”

时间:2022-06-12 06:11:11

<!-- Comment --> is the way to add comments in an XML file. Doesn't that actually means, that this part is not "compiled"?

<! - Comment - >是在XML文件中添加注释的方法。这实际上是不是意味着这部分不是“编译”的?

However, when I do something like this:

但是,当我做这样的事情时:

<item android:id="@+id/ss3"
    android:icon="@drawable/some_icon"
    android:title="Blabla Title"
    tools:ignore="AppCompatResource"
    <!-- -->
/>

I get an error "Tag start is not closed". Why?

我收到错误“标签启动未关闭”。为什么?

1 个解决方案

#1


6  

Comments are not allowed inside tags. You have to close the tag first with ">" or "/>" and then you can add your comment there.

标签内不允许注释。您必须先使用“>”或“/>”关闭代码,然后才能在那里添加评论。

#1


6  

Comments are not allowed inside tags. You have to close the tag first with ">" or "/>" and then you can add your comment there.

标签内不允许注释。您必须先使用“>”或“/>”关闭代码,然后才能在那里添加评论。