github地址:https://github.com/GarsonZhang/butterknife

Butter Knife

Field and method binding for Android views which uses annotation processing to generate boilerplate code for you.

  • Eliminate findViewById calls by using @BindView on fields.
  • Group multiple views in a list or array. Operate on all of them at once with actions, setters, or properties.
  • Eliminate anonymous inner-classes for listeners by annotating methods with @OnClick and others.
  • Eliminate resource lookups by using resource annotations on fields.
class ExampleActivity extends Activity {
@BindView(R.id.user) EditText username;
@BindView(R.id.pass) EditText password; @BindString(R.string.login_error) String loginErrorMessage; @OnClick(R.id.submit) void submit() {
// TODO call server...
} @Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simple_activity);
ButterKnife.bind(this);
// TODO Use fields...
}
}

For documentation and additional information see the website.

Remember: A butter knife is like a dagger only infinitely less sharp.

Download

Add this to you project-level build.gradle:

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}

Add this to your module-level build.gradle:

apply plugin: 'android-apt'

android {
...
} dependencies {
compile 'com.jakewharton:butterknife:8.0.1'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
}

Make sure the line apply plugin ... is placed somewhere at the top of the file.

Snapshots of the development version are available in Sonatype's snapshots repository.

Android:Butter Knife 8.0.1配置的更多相关文章

  1. android Butter Knife 使用详解

    Butter Knife github连接:https://github.com/JakeWharton/butterknife 本文使用的butterknife版本7.0.1 butterknife ...

  2. Android Studio & Butter Knife —— 快速开发

    Butter Knife是一个Android的注解框架,可以帮助用户快速完成视图.资源与对象的绑定,完成事件的监听.(也就是少写findViewById()) 具体的介绍可以参考官方主页: http: ...

  3. [轉]Android Libraries 介紹 - Butter knife

    原文地址 Butter Knife 簡介 Butter Knife - Field and method binding for Android views.助你簡化程式碼,方便閱讀. 使用方法 開發 ...

  4. android注解[Jake Wharton Butter Knife]

    Introduction Annotate fields with @InjectView and a view ID for Butter Knife to find and automatical ...

  5. Android RoboGuice开源框架、Butter Knife开源框架浅析

    Google Guice on Android(RoboGuice) 今天介绍一下Google的这个开源框架RoboGuice, 它的作用跟之前讲过的Dagger框架差点儿是一样的,仅仅是Dagger ...

  6. ArcGIS Runtime for Android开发教程V2.0(2)开发环境配置

    原文地址: ArcGIS Runtime for Android开发教程V2.0(2)开发环境配置 - ArcGIS_Mobile的专栏 - 博客频道 - CSDN.NET http://blog.c ...

  7. Butter Knife使用详解

    Butter Knife Github地址: https://github.com/JakeWharton/butterknife 官方说明给出的解释是 Bind Android views and ...

  8. Butter Knife 黄油刀

    简介 Github:https://github.com/JakeWharton/butterknife  文档 特点: 采用注解的方式实现强大的View绑定和Click事件处理功能,简化代码,提升开 ...

  9. Butter Knife:一个安卓视图注入框架

    Butter Knife:一个安卓视图注入框架 2014年5月8日 星期四 14:52 官网: http://jakewharton.github.io/butterknife/ GitHub地址: ...

随机推荐

  1. 【转】Eclipse 常用快捷键 (动画讲解)

    Eclipse有强大的编辑功能, 工欲善其事,必先利其器, 掌握Eclipse快捷键,可以大大提高工作效率. 小坦克我花了一整天时间, 精选了一些常用的快捷键操作,并且精心录制了动画, 让你一看就会. ...

  2. AIM Tech Round 3 (Div. 2) A B C D

    虽然打的时候是深夜但是状态比较好 但还是犯了好多错误..加分场愣是打成了降分场 ABC都比较水 一会敲完去看D 很快的就想出了求0和1个数的办法 然后一直wa在第四组..快结束的时候B因为低级错误被h ...

  3. Run P4 without P4factory - A Simple Example In Tutorials. -2

    Reference:Github-Tutorial Exercise 2: Implementing TCP flowlet switching 实验准备: 参考之前的博客:Run P4 withou ...

  4. Objective-c 代理模式(delegate)

    Objective-c 代理模式(delegate) (2012-07-31 22:04:39) 转载▼ 标签: 杂谈 分类: iOS Objective-c 代理模式(delegate)     一 ...

  5. 14交互活动:XHTML表单

    表单基本上就是带有一块输入信息区域的网页.当提交表单时,表单中的信息被打成一个数据包发送给web服务器,web应用程序对之经行处理.处理完成后,可以获得另一个相应页面. 使用<form>元 ...

  6. Git 学习01

    一.下载并安装git bash 双击打开出现命令窗口 创建一个版本库非常简单,首先,选择一个合适的地方,创建一个空目录: cd F: mkdir learngit pwd F/learngit 显示当 ...

  7. 《Linux内核分析》第四周 扒开系统调用的“三层皮”

    [刘蔚然 原创作品转载请注明出处 <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000] WEEK FOUR( ...

  8. 《Linux内核设计与实现》CHAPTER18阅读梳理

    <Linux内核设计与实现>CHAPTER18阅读梳理 [学习时间:2hours] [学习内容:bug的来源分析:bug调试途径] 一.bug来源 1.内核中的bug 内核中的bug表现得 ...

  9. 多个java文件编译并打成jar包经典方法

    首先,多个java文件的编译 find . -type f -name *.java > compilelist (.代表当前路径) javac -cp "$CLASSPATH&quo ...

  10. Inside Flask - 配置的实现

    Inside Flask - 配置的实现 flask 的配置对象 app.config 本身使用很简单,无非就是以字典的形式使用,而它的实现,本身就是以字典的形式的. 在 flask/config.p ...