将限定类添加到Java注释而不是导入类

时间:2016-03-14 17:54:57

标签: java android android-studio intellij-idea comments

Android Studio(Intellij)提供了一个选项,而不是在注释中使用它时导入类(如下所示):

package com.mypackage;
import android.content.Intent;
/**
 * List all request codes used in our app.
 *  Ex: the request code used to call
 *  {@link android.app.Activity#startActivityForResult(Intent, int)}
 */
public final class RequestCodes {

    public static final int UNDEFINED = 110;

    public static final int ACTIVITY_REQUEST_OPEN_ACCOUNT = 21;
    public static final int AUTOCOMPLETE = 12;
    public static final int BARCODE = 13;
    public static final int CAPTURE_CAMERA_REQUEST = 14;
    public static final int DISPLAY_TEXT = 5;
    public static final int GET_PICTURE_FROM_CAMERA = 16;
    public static final int GET_PICTURE_FROM_GALLERY = 17;
    public static final int GOOGLE_SIGN_IN_REQUEST_CODE = 18;
    public static final int IMAGE_SELECTION = 19;
    public static final int MAP_REQUEST = 110;
    public static final int SELECT_PHOTO = 111;
    public static final int RUNTIME_PERMISSION = 121;
}

在注释中使用限定类名(如下所示):

package com.mypackage;

/**
 * List all request codes used in our app.
 *  Ex: the request code used to call
 *  {@link android.app.Activity#startActivityForResult(android.content.Intent, int)}
 */
public final class RequestCodes {
    .... same as previous
}

评论中是否存在使用android.content.Intent选项代替import 的评论?

1 个答案:

答案 0 :(得分:0)

我找到了解决方案,但我必须使用“始终”,因为“如果尚未导入”则无效。

Android Studio Preferences