我可以在Android工作室使用快捷键来生成javadoc评论吗?
如果不是,生成javadoc注释的最简单方法是什么?
我可以在Android工作室使用快捷键来生成javadoc评论吗?
如果不是,生成javadoc注释的最简单方法是什么?
当前回答
下面是一个来自Oracle的JavaDoc注释示例:
/**
* Returns an Image object that can then be painted on the screen.
* The url argument must specify an absolute {@link URL}. The name
* argument is a specifier that is relative to the url argument.
* <p>
* This method always returns immediately, whether or not the
* image exists. When this applet attempts to draw the image on
* the screen, the data will be loaded. The graphics primitives
* that draw the image will incrementally paint on the screen.
*
* @param url an absolute URL giving the base location of the image
* @param name the location of the image, relative to the url argument
* @return the image at the specified URL
* @see Image
*/
public Image getImage(URL url, String name) {
try {
return getImage(new URL(url, name));
} catch (MalformedURLException e) {
return null;
}
}
基本格式可以通过以下两种方式自动生成:
将光标置于方法上方,并键入/** + Enter 将光标定位在方法名上,按Alt + Enter >,单击Add JavaDoc
其他回答
可以使用IDE的自动完成功能自动添加Javadoc注释。尝试输入/**并按Enter生成一个示例Javadoc注释。
/**
*
* @param action The action to execute.
* @param args The exec() arguments.
* @param callbackContext The callback context used when calling back into JavaScript.
* @return
* @throws JSONException
*/
您可以从Settings-> plugin ->Browse repository中安装JavaDoc plugin。
从下面的链接获取插件文档
JavaDoc插件文档
Android Studio ->首选项->编辑器->意图-> Java ->声明->启用“添加JavaDoc”
并且,当选择方法来实现(Ctrl/Cmd + i),在左下角,你应该看到复选框启用复制JavaDoc。
添加Javadoc
/** +返回 在方法名称中设置光标->选项+返回->添加Javadoc
在Android Studio中,你不需要插件。在Mac上,只需打开Android Studio ->单击顶部栏中的Android Studio ->单击preferences ->在列表中找到文件和代码模板->选择包含->构建它,并将在所有项目中持久存在