、inputType 等不会引发警告。将鼠标悬-6ren">
gpt4 book ai didi

android - 禁用 Lint 警告 "The view name suggests this is a number but it does not include a numeric inputType"

转载 作者:太空宇宙 更新时间:2023-11-03 12:58:02 26 4
gpt4 key购买 nike

我在 Lint 错误检查首选项中搜索了警告列表,但找不到。列表有点长,无法检查每个警告是否是我想要的,并用namenumbernumeric过滤警告>、inputType 等不会引发警告。将鼠标悬停在警告上似乎不会提供警告 ID

我有充分的理由为名称中带有数字的变量使用文本 inputType,这是因为我想登录到使用数字作为登录 ID 的服务器,因此我需要数字作为字符串。我真的不喜欢那里有警告,如果可能的话,我想禁用该特定警告。

谢谢。

最佳答案

您也可以在 XML 中执行此操作,方法是将 xmlns:tools="http://schemas.android.com/tools"tools:ignore="TextFields" 添加到您的 XML 标记中。 (如果你打算不止一次这样做,你当然应该将 xmlns 部分放在父标签中,甚至放在顶级标签中,这样你就不必每次都重复)。这样做的好处是您可以它的那个实例抑制它,这样如果它再次发生(意外)您仍然会收到警告。

关于android - 禁用 Lint 警告 "The view name suggests this is a number but it does not include a numeric inputType",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16388421/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com