且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我可以将我的android项目中的资源标记为已弃用吗?

更新时间:2023-02-09 13:00:27

简短答案:不可能.

@deprecated标签,因为它可以在 fw/base core/res/values/public.xml 以及整个项目中的其他地方,但似乎用于构建应用程序的构建工具只是跳过了所有注释,这意味着在制作此方法的过程中也会跳过注释标签失败.

@deprecated tags are used by the Android source inside comments as it can be seen in fw/base core/res/values/attrs.xml (see line 3427 for autoText as referred to in the original post), in fw/base core/res/values/public.xml and in other places throughout the project, but it appears that the build tools used for building applications simply skip all comments meaning the annotiation tags get skipped as well in the process making this method fail.

基于Android来源的弃用注释的用法示例:

Example usage of deprecation annotations based on Android source:

<!-- {@deprecated Use foobar instead.} -->
<string name="foo">abc</string>
<string name="foobar">abcd</string>