【问题标题】:JavaDoc for Android XML (string) resources用于 Android XML(字符串)资源的 JavaDoc
【发布时间】:2015-05-27 11:46:59
【问题描述】:

有没有办法将评论/描述/文档添加到 android 资源参考?我知道的唯一方法是使用标准 XML 注释。这显然不理想。

类似特殊属性或特殊 javadoc 前置元素的东西

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

【问题讨论】:

    标签: android xml documentation javadoc android-resources


    【解决方案1】:

    以下格式允许文件头(使用 XML 文档 cmets)以及与每个资源条目一起出现的单个注释(文档属性)。我没有让编译器抱怨需要包含 documentation 的特定命名空间(xmlns:tools 除外)。

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

    【讨论】:

    • 谢谢,文档属性有效。但它仍然没有集成到 androidstudio show-javadoc-autocomplete 功能中。这是很好的中间步骤。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-14
    • 2011-05-08
    • 2013-04-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多