《!--suppress ALL --> 在Android XML 文件中的用途是什么?

2022-10-31,,,

《!--suppress ALL --> 在Android XML 文件中的用途是什么?

警告一次又一次地出现在谷歌地图的 XML 文件中,但是当我使用时,所有警告都被禁用。那么压制所有评论有什么好处呢?

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

《!--suppress ALL --> 说“亲爱的 linter,请不要将我在这里写的任何内容标记为无效 -不用管它”是一种相当激烈的方式。

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

话虽如此,除非您绝对确定对它们无能为力,否则使用它并不是明智的决定,因为大量忽略所有警告是日后让自己陷入困境的好方法。

《!--suppress ALL --> 在Android XML 文件中的用途是什么?的相关教程结束。

《《!--suppress ALL --> 在Android XML 文件中的用途是什么?.doc》

下载本文的Word格式文档,以方便收藏与打印。