我可以将我的android项目中的资源标记为已弃用吗? [英] Can I mark a resource in my android project as deprecated?

查看:106
本文介绍了我可以将我的android项目中的资源标记为已弃用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Android库,我想将某些资源标记为已弃用. 可绘制的图形,尺寸,持续时间...我读到某处可以在资源定义中添加deprecated ="deprecated",但似乎没有任何作用.

I have an android library for which I would like to mark some resources as deprecated. Drawables, dimensions, durations... I read somewhere that I could add deprecated="deprecated" to the resource definition but it doesn't seem to do anything.

在Android R中,您可以看到诸如

In Android R you can see things such as

@java.lang.Deprecated
public static final int autoText = 16843114;

我正在尝试通过编辑durations.xml,values.xml甚至public.xml来产生类似的东西...

I'm trying to produce something similar by editing durations.xml, values.xml, or even public.xml...

谢谢!

推荐答案

简短答案:不可能.

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

这篇关于我可以将我的android项目中的资源标记为已弃用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆