In order to code the efficiency, we have a butterknife, the basic use of the following steps:
1. In Android studio setting, download plugin
2. Add butterknife dependencies throughout the build.gradle of the project
buildscript {repositories {jcenter () maven{URL "https://jitpa Ck.io "}} dependencies {classpath ' com.android.tools.build:gradle:2.2.2 ' // Note:do not place your application dep Endencies here; They belong // in the individual module bui Ld.gradle files }}allprojects {repositories {jcenter () Maven {u RL "Https://jitpack.io" }}}task Clean (type:delete) {Delete rootproject.buildd IR}
3. Add butterknife dependencies to the module you want to use
Apply plugin: ' Com.android.application ' Apply plugin: ' com.neenbedankt.android-apt 'Android {compilesdkversion25buildtoolsversion"25.0.3"Defaultconfig {ApplicationID"Com.lemon.livecircledemo"minsdkversion21sttargetsdkversion25Versioncode1Versionname"1.0"Testinstrumentationrunner"Android.support.test.runner.AndroidJUnitRunner"} buildtypes {release {minifyenabledfalseproguardfiles Getdefaultproguardfile (' Proguard-android.txt '), ' Proguard-rules.pro '}}}dependencies {compile Filetree (dir:' Libs ', include: [' *.jar ']) Androidtestcompile (' com.android.support.test.espresso:espresso-core:2.2.2 ', {Exclude group:' Com.android.support ', module: ' Support-annotations '}) Compile' com.android.support:appcompat-v7:25.3.1 'Testcompile' junit:junit:4.12 'Compile' com.android.support:design:25.1.0 '//View Binding Butterknife compile ' com.jakewharton:butterknife:8.4.0 ' apt ' com.jakewharton:butterknife-compiler:8.4.0 'Compile' De.greenrobot:eventbus:3.0.0-beta1 '//introduction of OkhttpCompile ' com.squareup.okhttp3:okhttp:3.5.0 '//Introduction of RetrofitCompile ' com.squareup.retrofit2:retrofit:2.1.0 '//introduction of RxjavaCompile ' io.reactivex.rxjava2:rxjava:2.0.4 '//Log Interceptor is introduced to facilitate debug mode output log informationCompile ' com.squareup.okhttp3:logging-interceptor:3.5.0 '//introduction of Rxjava Adapter for easy Rxjava and retrofit integrationCompile ' com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0 '//A JSON converter is introduced to facilitate the conversion of returned data to JSON formatCompile ' com.squareup.retrofit2:converter-gson:2.1.0 '//introduction of RxandroidCompile ' io.reactivex.rxjava2:rxandroid:2.0.1 'Compile' com.github.bumptech.glide:glide:3.7.0 'Compile' com.android.support:cardview-v7:25.1.0 'Compile' com.android.support:recyclerview-v7:25.1.0 'Compile' com.github.aspsine:irecyclerview:0.0.5 '}
4. In your Setcontentview (), select the layout, right-generator, and automatically generate the associated view bindings in your code.
Android Development Learning--butterknife use