eclipse 有没有办法禁用xml警告?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10039016/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 17:58:59  来源:igfitidea点击:

Is there a way to disable the xml warnings?

androideclipse

提问by Yevgeny Simkin

I just did an update of my SDK and now eclipse is giving me all sorts of totally unwanted warnings in my xml... for example I have a RelativeLayout that doesn't have an id or a background (it's actually a transparent button) and eclipse is warning me that it's a useless element. Is there a way to turn this idiocy off?

我刚刚更新了我的 SDK,现在 eclipse 在我的 xml 中给了我各种完全不需要的警告......例如我有一个没有 id 或背景的 RelativeLayout(它实际上是一个透明按钮)和eclipse 警告我它是一个无用的元素。有没有办法关闭这种白痴?

TIA

TIA

采纳答案by Herry

In New Update of Eclipse ADT Plugins will give you New Tool Which Name is Lint here is one SO Link for this tool and it's advantages .Click Here

在 Eclipse ADT 插件的新更新中,将为您提供名称为 Lint 的新工具,这是此工具的一个 SO 链接及其优点。点击这里

Now for Disable xml Warnings that are come from Lint Android Tool ,you need to go

现在对于来自 Lint Android 工具的禁用 xml 警告,你需要去

Window-->Preferences-->Android-->Lint Error Checking

窗口-->首选项-->Android-->Lint 错误检查

in this Dialog you will find all Issue for Xml in android and you can make disable it ,if you want to disable.And Make sure you will not disable usefull lint warning because it's help us to find there are multiple ID assign in xml and lot more..

在此对话框中,您将在 android 中找到 Xml 的所有问题,如果您想禁用它,您可以禁用它。并确保您不会禁用有用的 lint 警告,因为它可以帮助我们找到 xml 中分配的多个 ID 和批次更多的..

回答by alphonzo79

According to the documentation at http://tools.android.com/recent/ignoringlintwarningsyou do this by including the tools xmlns:

根据http://tools.android.com/recent/ignoringlintwarnings上的文档,您可以通过包含工具 xmlns 来执行此操作:

xmlns:tools="http://schemas.android.com/tools"

And then adding a tools:ignore annotation in the relevant elements:

然后在相关元素中添加一个 tools:ignore 注释:

<RelativeLayout
    tools:ignore="UselessParent"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="30dp"
    android:layout_centerInParent="true">