Android Development Learning--butterknife use

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.