Reference Blog: Butterknife usage details (7.0 version)
Reference Blog: Android annotations using Butterknife 8.0 Introduction to Annotations
Reference blog: Android butterknife 8.4.0 How to use summary
Using the Butterknife Zelezny plugin
Reference blog: Android butterknife zelezny plug-in installation and use (visual one-click Generation)
Download
Use
Note: The annotation method does not work correctly.
Try to resolve:
View the official compilation configuration as follows:
dependencies { compile ' com.jakewharton:butterknife:8.6.0 ' annotationprocessor ' Com.jakewharton: butterknife-compiler:8.6.0 '}
Buildscript { repositories { mavencentral () } dependencies { classpath ' Com.jakewharton: butterknife-gradle-plugin:8.6.0 ' }}
Apply plugin: ' com.android.library ' Apply plugin: ' Com.jakewharton.butterknife '
Address: Https://github.com/JakeWharton/butterknife
Reference blog: butterknife 8.0.1 not in effect
Note: Try to build, there is a build problem
Reference blog: What is Android Gradle build tool (Android Gradle build tools)?
Download SDK 25 with Build-tools 25.0.3
Note: Annotationprocessor Error issues
Reference blog: How to use annotations compiled for Android annotations android-apt How to switch to Annotationprocessor
Code Application Example:
@BindView (r.id.login_progress) ProgressBar loginprogress; @BindView (r.id.user_text) Autocompletetextview usertext; @BindView (r.id.password_text) EditText passwordtext; @BindView (R.id.sign_in_button) button Signinbutton; @BindView (r.id.email_login_form) linearlayout emailloginform; @BindView (r.id.login_form) ScrollView loginform;
@OnEditorAction (R.id.password_text) Public BooleanOnpasswordeditor (TextView TextView,intID, keyevent keyevent) { if(id = = R.id.login | | id = =editorinfo.ime_null) {LOG.E ("IOException", "Onpasswordeditor"); Attemptlogin (); return true; } return false; } @OnClick (R.id.sign_in_button) Public voidonsigninclicked () {LOG.E ("IOException", "onsigninclicked"); Attemptlogin (); }
Getting Started with Android programming-open source framework Butterknife