TODO
https://developer.android.com/topic/libraries/support-library/features#v4
https://developer.android.com/reference/android/support/v4/app/package-summary
Material Design
http://design.1sters.com/material_design/components/lists.html#
https://blog.csdn.net/johnny901114/article/details/51918436
概述
Support Annotation Library
元注解,帮助开发者在编译期间发现可能存在的bug;如果出现违反注解的代码AndroidStudio会给出提示,lint扫描的时候也会给出错误提示
Null注解
● Nullable 作用于函数参数或返回值,表示其可以为空
● NonNull 作用于函数参数或返回值,表示其不可以为空
资源类型
● AnimatorRes:标记整型值是android.R.animation类型。
● AnimRes:标记整型是android.R.anim类型。
● AnyRes:标记整型是任何一种资源类型,如果确切知道表示的是哪一个具体资源的话,建议显式指定。
● ArrayRes:标记整型是android.R.array类型。
● AttrRes:标记整型是android.R.attr类型。
● BoolRes:标记整型是布尔类型。
● ColorRes:标记整型是android.R.color类型。
● DrawableRes:标记整型是android.R.drawable类型。
● FranctionRes:标记整型值是fraction类型,这个比较少见,这种类型资源常见于Animation Xml中,比如50%,表示占parent的50%
● IdRes:标记整型是android.R.id类型。
● IntegerRes:标记整型是android.R.integer类型。
● InterpolatorRes:标记整型是android.R.interpolator类型,插值器,在Animation
Xml中使用较多。
● LayoutRes:标记整型是android.R.layout类型。
● MenuRes:标记整型是android.R.menu类型。
● RawRes:标记整型是android.R.raw类型。
● StringRes:标记整型是android.R.string类型。
● StyleableRes:标记整型是android.R.styleable类型。
● StyleRes:标记整型是android.R.style类型。
● XmlRes:标记整型是android.R.xml类型。
类型定义注解,替代枚举
public static final int TEST_1 = 0;
public static final int TEST_2 = 1;
public static final int TEST_3 = 2;
//定义类型注解
@Retention(RetentionPolicy.SOURCE)
@IntDef({TEST_1,TEST_2,TEST_3})
public @interface TestAnnotation{
}
@TestAnnotation
public abstract int getTestAnnotation();
//这样testAnnotation的值只能是 @IntDef({TEST_1,TEST_2,TEST_3}) 中的一个
public abstract void setTestAnnotation</