有没有办法如何添加注释/描述/文档到Android资源引用?我知道的唯一方法是使用标准的XML注释。这显然不太理想。
像特殊属性或特殊的javadoc pre-element
之类的东西<resources>
<string documentation="Some useful information what does this resource means..." name="KEY" translatable="false">value</string>
</resources>
<resources>
<documentation forName="KEY">Some useful information what does this resource means...</documentation>
<string name="KEY" translatable="false">value</string>
</resources>
不理想但目前功能正常:
<resources>
<!-- Some useful information about what this resource means... -->
<string name="KEY" translatable="false">value</string>
</resources>
答案 0 :(得分:0)
以下格式允许使用文件头(使用XML文档注释),以及与每个资源条目一起使用的单个注释(文档属性)。我没有让编译器抱怨需要包含xmlns:tools
的特定命名空间(documentation
除外)。
<?xml version="1.0" encoding="utf-8"?>
<!--=============================================================================================
My File description here
==============================================================================================-->
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="Application_Name" documentation="Name of the application. Used as Activity Name as the title, and appears in About box">FantasticApp</string>
</resources>