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);
     

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

  • 相关阅读:
    测试文档
    详细文档
    需求规格说明文档
    会议
    软工项目
    分组
    项目名
    google 常用的搜索关键词 (技术相关)
    Kafka 入门和 Spring Boot 集成
    用nginx实现分布式限流
  • 原文地址:https://www.cnblogs.com/zhaogaojian/p/9776942.html
Copyright © 2011-2022 走看看