在Android XML文件中<! - 压制ALL - >的目的是什么?

时间:2016-10-26 03:00:50

标签: xml android-studio

警告一次又一次地进入谷歌地图的XML文件,但当我使用<!--suppress ALL-->时,所有警告都被禁用。那么压制所有评论有什么好处?

<!--suppress ALL-->

<RelativeLayout
    android:id="@+id/rlMapLayout"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1.2"
    android:orientation="vertical" >

    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width=`enter code here`"match_parent"
        android:layout_height="match_parent" />
</RelativeLayout>

1 个答案:

答案 0 :(得分:2)

<!--suppress ALL-->是一种相当激烈的方式来说“亲爱的短信,请不要将任何标记为我在这里写的无效 - 请一言不发。”

这样做的好处充其量是混合的,但如果你绝对确定你正在编写不需要验证的XML,或者你选择不首先验证的XML,那么它可能是有利的。 / p>

话虽如此,使用它并不是明智的决定,除非你完全确定你无法对它们做任何事情,因为大量忽略所有警告是让你自己陷入麻烦的好方法。