2016-03-14 51 views
0

的Android工作室(的IntelliJ)提供了一個選項,而不是導入一個類時,它在評論只是使用(如下圖):添加限定類到Java註釋,而不是導入類

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 
} 

存在於評論而不是import只是評論的選項使用android.content.Intent

回答

0

我找到了解決方案,但我必須使用「始終」,因爲「如果尚未導入」不起作用。

Android Studio Preferences