插件介绍:ButterKnife是一个专注于Android系统的View注入框架,可以减少大量的findViewById以及setOnClickListener代码,可视化一键生成。又一神器,完美告别findViewById和setOnClickListener,由于是编译期生成代码的方式,对运行时没有任何副作用,只是编译期有一点点时间成本而已。

-------------------------------------------------------------下载插件-----------------------------------------------------------------

Android主面板--》File--》Settings--》Plugins--》Browse Repositories...--》查询框输入Android ButterKnife Zelezny查询--》点击Install下载

下载完毕提示重启AndroidStudio,确认重启即可

-------------------------------------------------------------下载插件-----------------------------------------------------------------

-------------------------------------------------------------配置插件依赖项-----------------------------------------------------------------

第二项配置:build.gradle(Module:app)配置为红色代码↓↓↓↓

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.jakewharton.butterknife'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1" defaultConfig {
applicationId "com.example.ly.blogtestbutterknife"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
} dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.jakewharton:butterknife:8.4.0' apt 'com.jakewharton:butterknife-compiler:8.4.0'
}

第三项配置:build.gradle(Project)配置为红色代码↓↓↓↓

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
} allprojects {
repositories {
jcenter()
}
} task clean(type: Delete) {
delete rootProject.buildDir
} -------------------------------------------------------------使用插件-----------------------------------------------------------------

ButterKnife Zelezny从配置到使用的更多相关文章

  1. 手把手教android studio中安装Android Butterknife Zelezny (转)

    原文地址:http://blog.csdn.net/xin917480852/article/details/51176524 用来快速生成findViewById() 安装方法: 打开Android ...

  2. Android Studio上方便使用butterknife注解框架的偷懒插件Android Butterknife Zelezny

    首先提下ButterKnifey已经更新到版本7.0.1了,现在注解已经不叫@InjectView了,而叫@Bind,感觉更贴合语义.同时注册的方式也从 ButterKnife.inject(this ...

  3. 使用butterknife zelezny插件时必须保证已导入butterKnife的库工程。

    使用butterknife zelezny插件时必须保证已导入butterKnife的库工程. 另外需要把光标定位到setContentView(R.layout.activity_main);中的a ...

  4. 懒人习惯之ButterKnife Zelezny

    项目地址:https://github.com/avast/android-butterknife-zelezny   这个是Android Studio的插件. 其实就间接帮你把LoadView的过 ...

  5. 使用butterknife注解project配置

    使用butterknife注解的时候建议使用Jar包 Jar包下载地址:https://github.com/JakeWharton/butterknife Eclipseproject配置: 步骤一 ...

  6. Butterknife 导入项目配置

    在app的 build.gradle 文件中添加 dependencies { // Butterknifeapi 'com.jakewharton:butterknife:8.6.0'annotat ...

  7. ButterKnife不同版本配置

    7.0.1版本 compile 'com.jakewharton:butterknife:7.0.1' 8.0.1版本 module: apply plugin: 'com.android.appli ...

  8. 关于ButterKnife 设置全局配置

    先在项目的根目录的build.grade添加:classpath'com.neenbedankt.gradle.plugins:android-apt:1.8'  然后在app build.grade ...

  9. Android 注解工具 ButterKnife

    Butter Knife 是 Android 视图字段和方法绑定,使用注解处理来生成样板代码. 主要特性: 在字段使用 @FindView消除findViewById调用 使用 @FindViews在 ...

随机推荐

  1. css 填坑常用代码分享

    以下是常用的代码收集,没有任何技术含量,只是填坑的积累.转载请注明出处,谢谢. 因为提交比较麻烦,后来转置github:https://github.com/jsfront/src/blob/mast ...

  2. Java Spring mvc 操作 Redis 及 Redis 集群

    本文原创,转载请注明:http://www.cnblogs.com/fengzheng/p/5941953.html 关于 Redis 集群搭建可以参考我的另一篇文章 Redis集群搭建与简单使用 R ...

  3. 你可能没注意的CSS单位

    扶今追昔 CSS中的单位我们经常用到px.pt.em.百分比,px和pt不用多说 em em是相对单位,参考物是父元素的font-size,具有继承的特点 如果字体大小是16px(浏览器的默认值),那 ...

  4. Java在DOS命令下的运行及其API文档制作过程

    该文档主要描述java程序在DOS命令下的运行,以及一些常用的命令 常用DOS命令: d: 回车 盘符切换 dir(directory):列出当前目录下的文件以及文件夹 md (make direct ...

  5. ABP(现代ASP.NET样板开发框架)系列之12、ABP领域层——工作单元(Unit Of work)

    点这里进入ABP系列文章总目录 基于DDD的现代ASP.NET开发框架--ABP系列之12.ABP领域层——工作单元(Unit Of work) ABP是“ASP.NET Boilerplate Pr ...

  6. ABP框架 - 应用服务

    文档目录 本节内容: IApplicationService 接口 ApplicationService 类 CrudAppService 和 AsyncCrudAppService 类 简单的CRU ...

  7. xp搭建IIS出现HTTP 500错误-2147467259 (0x80004005)

    安装IIS后访问localhost页面, 提示The remote procedure call failed and did not execute,再刷新变为:-2147467259 (0x800 ...

  8. 使用 Swagger 自动生成 ASP.NET Core Web API 的文档、在线帮助测试文档(ASP.NET Core Web API 自动生成文档)

    对于开发人员来说,构建一个消费应用程序时去了解各种各样的 API 是一个巨大的挑战.在你的 Web API 项目中使用 Swagger 的 .NET Core 封装 Swashbuckle 可以帮助你 ...

  9. javascript中字符串的比较规则

    弄清这个还是很重要的,在字符排序中很有用处 非空字符串 > 空字符串 从第一个字符的charCode开始比较,大的就大 所有的字符都相同,就比较长度,长的大 '0'>'' '2'>' ...

  10. jquery.fn.extend与jquery.extend--(初体验二)

    1.jquery.extend(object); 为扩展jQuery类本身.为类添加新的方法. jquery.fn.extend(object);给jQuery对象添加方法. $.extend({ a ...