ank*_*h13 24 xml android android-layout
如何在android布局的xml文件中发表评论.我在Android Layout xml中看过评论 - 但我想在父母内部发表评论.
当我尝试这样做时,我在eclipse中遇到错误:
<Button android:text="Button"
<!-- this is a comment -->
android:id="@+id/Discon" >
</Button>
Run Code Online (Sandbox Code Playgroud)
从xml的背景知识,我开始知道我们不能在属性中添加注释.有没有办法删除id作为属性并将其指定为元素?
或者有没有办法在元素属性中添加注释?
P.M*_*lch 28
你不能在标签内嵌入评论.标签之间不是问题
<!--
this is a comment
-->
<Button android:text="Button"
android:id="@+id/Discon" >
</Button>
Run Code Online (Sandbox Code Playgroud)
如果你想临时注释掉一个属性(如果那是你想知道的),你将不得不将它移到标签上并在那里注释.
<Button android:text="Button"
android:id="@+id/Discon"
>
</Button>
==>
<!-- android:id="@+id/Discon" -->
<Button android:text="Button"
>
</Button>
Run Code Online (Sandbox Code Playgroud)
Dan*_*ete 11
从技术上讲,不是评论,你可以买
<Button comment="write whatever you want here" android:text="Button" ...
Run Code Online (Sandbox Code Playgroud)
或者,如果要临时删除属性,请android:从名称中删除.
基本上Android会忽略没有android:命名空间的所有内容.
| 归档时间: |
|
| 查看次数: |
28873 次 |
| 最近记录: |