- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
在阅读一些 android 示例时,我通常会看到像
这样的评论// BEGIN_INCLUDE (something)
// END_INCLUDE (something)
但是,我当前的 IDE——Android Studio 1.1——无法识别它们(或者我做错了什么)。我猜,它们用作某种代码区域标记(例如
//<editor-fold desc="Region name">
// some code
//</editor-fold>
在 AndroidStudio/IntellijIDEA 中),但这种语法很像 C++ 预处理器指令。所以问题是:我是否应该了解这些注释的一些重要信息(除了明显的注释功能之外)可以以任何方式改进我的代码?
最佳答案
它用于文档目的,用于识别要包含在目标文档中的 fragment 。它在编辑代码时并不是很有用;它有助于通过从实际代码生成文档来避免重复。
{@sample} and {@include}
These tags copy sample text from an arbitrary file into the output javadoc html.
The @include tag copies the text verbatim from the given file.
The @sample tag
- copies the text from the given file and strips leading and trailing whitespace
- reduces the indent level of the text to the indent level of the first non-whitespace line
- escapes all <, >; and & characters for html
- drops all lines containing either BEGIN_INCLUDE or END_INCLUDE so sample code can be nested
Both tags accept either a filename and an id or just a filename. If no id is provided, the entire file is copied. If an id is provided, the lines in the given file between the first two lines containing BEGIN_INCLUDE(id) and END_INCLUDE(id), for the given id, are copied. The id may be only letters, numbers and underscore ().
Four examples:
{@include samples/SampleCode/src/com/google/app/Notification1.java}
{@sample samples/SampleCode/src/com/google/app/Notification1.java}
{@include samples/SampleCode/src/com/google/app/Notification1.java Bleh}
{@sample samples/SampleCode/src/com/google/app/Notification1.java Bleh}
关于Android 示例评论 BEGIN_INCLUDE END_INCLUDE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29094073/
在阅读一些 android 示例时,我通常会看到像 这样的评论 // BEGIN_INCLUDE (something) // END_INCLUDE (something) 但是,我当前的 IDE—
我是一名优秀的程序员,十分优秀!