dan*_*nte 1 xml android android-studio
我是编写 xml 文件的初学者,它与 C 和 C++ 不同。那么,任何人都可以告诉我如何在此文件中发表评论吗?
您可以像这样使用html 注释标签:
<!--This is a comment. -->
Run Code Online (Sandbox Code Playgroud)
但请注意,如果您在 android xml 标签中添加注释,如下所示:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
<!--WARNING This is not a valid comment. -->
/>
Run Code Online (Sandbox Code Playgroud)
Android Studio 布局编辑器会给你一个错误。您只能将其添加到 xml标记之外,如下所示:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--This is a valid comment. -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19696 次 |
| 最近记录: |