As we all know, the Android resource file is an int type ID to save its reference, through the annotation type, we can write the code, the time to find the parameter type of error, avoid potential bugs, as follows:
By @LayoutRes We specify that the parameter must be in R.LAYOUT.XXX format, and the IDE will prompt us for errors
Introduction of annotation types into the project through Gradle
Compile ' com.android.support:support-annotations:23.1.1 '
Android native provides us with a range of annotation classes to support our development
Note Class Package location: Android SDK Path \extras\android\m2repository\com\android\support\support-annotations
We can find a 23.1.1 folder, find the inside of the Support-annotations-23.1.1-sources.jar, through Jd-gui view
With the class at the end of Res , we can limit the different types of Android resource IDs.
Inside other classes we can also look at, such as Nonnull, Nullable, limited scope Floatrange is also very interesting, as follows:
Android support Annotations: Android annotations get started quickly