AndroidStudio中布局文件xml的注释问题
-
注释的格式与html中相同
<!--注释-->
-
注释的位置需要注意
<?xml version="1.0" encoding="utf-8"?> <!-- 写在这里可以 --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" <!-- 写在这里不行 --> android:layout_width="match_parent" android:layout_height="match_parent"> <!-- 写在这里可以 --> <Button android:id="@+id/button_1" <!-- 写在这里不行 --> android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Button 1" /> <!-- 写在这里可以 --> </LinearLayout>
注释可以写在组件的前面或者后面
注释不能写在<>里面