0

所以我想用伪代码告诉自己一些关于 .xml 文件的事情,但是当我执行 // 时,它会像代码一样输入它,所以我不能在那里真正使用它。我可以做些什么来使代码像伪代码一样不可读?我在一个android应用程序中这样做。在 res/layout/(.xml 文件) 文件夹下。谢谢!

4

2 回答 2

3

XML中的注释是这样的

<!-- this is a comment -->

请注意,它们可以跨越多行

<!--
    This is a comment
    on multiple lines
-->

但它们不能嵌套

<!-- This <!-- is a comment --> This is not -->

你也不能在标签内使用它们

<EditText <!--This is not valid--> android:layout_width="fill_parent" />
于 2012-05-31T01:51:05.307 回答
0

HTML & XML 中的注释是这样的:

<!-- this is a comment -->

有关更多详细信息,请参阅关于 SGML 和 HTML:注释


建议:

<!-- textSize: For the 'hearing impaired'. --> 
<TextView 
    android:text="invalid" 
    android:textSize="25dp" 
    android:id="@+id/tvResults" 
    android:gravity="center" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" /> 
于 2012-05-31T01:48:15.750 回答