1、在注释中实现链接跳转
public void postInvalidate() {
postInvalidateDelayed(0);
}
public ViewPropertyAnimator x(float value) {
animateProperty(X, value);
return this;
}
public ViewPropertyAnimator setListener(Animator.AnimatorListener listener) {
mListener = listener;
return this;
}
public ViewPropertyAnimator setUpdateListener(ValueAnimator.AnimatorUpdateListener listener) {
mUpdateListener = listener;
return this;
}
public ViewPropertyAnimator withLayer() {
... ...
}
2、限定参数类型
TextView.setTextColor(@ColorInt int color)
3、限定参数类型及范围
TimePicker.setHour(@IntRange(from = 0, to = 23) int hour)
public static class ByteArray {
private @IntRange(from = 0) int mSize;
}
public class TextView ...{
@FloatRange(from = 0.0, to = 1.0)
private float getHorizontalFadingEdgeStrength(float position1, float position2) {
final int horizontalFadingEdgeLength = getHorizontalFadingEdgeLength();
if (horizontalFadingEdgeLength == 0) return 0.0f;
final float diff = Math.abs(position1 - position2);
if (diff > horizontalFadingEdgeLength) return 1.0f;
return diff / horizontalFadingEdgeLength;
}
}
参考文章:
1、https://www.android-doc.com/reference/packages.html