zoukankan      html  css  js  c++  java
  • ButterKnife使用

    1、BuildScripts,添加红色部分

    buildscript {
        repositories {
            jcenter()
            google()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.1'
            classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
            classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }

    2、app BuildGradle中添加红色部分

    apply plugin: 'com.android.application'
    apply plugin: 'org.greenrobot.greendao'
    apply plugin: 'com.jakewharton.butterknife'
    dependencies {
        implementation 'com.android.support:support-v4:26.1.0'
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.squareup.retrofit2:retrofit:2.1.0'
        compile 'com.google.code.gson:gson:2.6.2'
        compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0'
        compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta3'
        compile 'com.squareup.okhttp3:logging-interceptor:3.3.1'
        compile 'org.greenrobot:greendao:3.2.2'
        compile 'com.github.bumptech.glide:glide:3.7.0'
        compile 'com.google.zxing:core:3.3.0'
        compile 'com.android.support:appcompat-v7:26+'
        compile 'com.android.support:recyclerview-v7:26+'
        compile project(path: ':library')
        compile project(path: ':orbbec')
        implementation 'com.android.support.constraint:constraint-layout:1.1.3'
        compile 'com.jakewharton:butterknife:8.4.0'
        annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
    }

    3、Activity中测试

    @BindView(R2.id.test) Button btnTest;//使用ButterKnife方法绑定按钮
    
    
    onCreate中

    ButterKnife.bind(this);
     

    其他可以和传统按钮一样的方法使用,或者注解方式使用。

  • 相关阅读:
    [NOIP提高&洛谷P1024]一元三次方程求解 题解(二分答案)
    浅谈二分答案的原理和相关应用
    Python 30分钟入门指南
    LG P1721 [NOI2016]国王饮水记
    LG P5238 整数校验器
    亡灵序曲
    线性代数三部曲(三)·矩阵
    线性代数三部曲(二)·Gauss消元
    关于$color{darkblue}{Anverking}$的介绍
    线性代数三部曲(一)·行列式
  • 原文地址:https://www.cnblogs.com/zhaogaojian/p/9776942.html
Copyright © 2011-2022 走看看