Most visited

Recently visited

IntDef

public abstract @interface IntDef
implements Annotation

android.support.annotation.IntDef


表示整数类型的注释元素表示一个逻辑类型,并且它的值应该是明确命名的常量之一。 如果IntDef#flag()属性设置为true,则可以组合多个常量。

例:


  @Retention(SOURCE)
  @IntDef({NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS})
  public @interface NavigationMode {}
  public static final int NAVIGATION_MODE_STANDARD = 0;
  public static final int NAVIGATION_MODE_LIST = 1;
  public static final int NAVIGATION_MODE_TABS = 2;
  ...
  public abstract void setNavigationMode(@NavigationMode int mode);
  @NavigationMode
  public abstract int getNavigationMode();
 
For a flag, set the flag attribute:

  @IntDef(
      flag = true
      value = {NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS})
 

Summary

Inherited methods

From interface java.lang.annotation.Annotation

Hooray!