如何在res / layout文件夹下的.xml文件中使用Pseudo Code? Android的

时间:2012-05-31 01:47:19

标签: java android xml pseudocode sgml

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

2 个答案:

答案 0 :(得分: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" />

答案 1 :(得分:0)

HTML&amp;中的评论XML就像这样:

<!-- this is a comment -->

有关详细信息,请参阅On SGML and HTML: Comments


建议:

<!-- 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" />