Android:Butter Knife 8.0.1配置
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配置的更多相关文章
- android Butter Knife 使用详解
Butter Knife github连接:https://github.com/JakeWharton/butterknife 本文使用的butterknife版本7.0.1 butterknife ...
- Android Studio & Butter Knife —— 快速开发
Butter Knife是一个Android的注解框架,可以帮助用户快速完成视图.资源与对象的绑定,完成事件的监听.(也就是少写findViewById()) 具体的介绍可以参考官方主页: http: ...
- [轉]Android Libraries 介紹 - Butter knife
原文地址 Butter Knife 簡介 Butter Knife - Field and method binding for Android views.助你簡化程式碼,方便閱讀. 使用方法 開發 ...
- android注解[Jake Wharton Butter Knife]
Introduction Annotate fields with @InjectView and a view ID for Butter Knife to find and automatical ...
- Android RoboGuice开源框架、Butter Knife开源框架浅析
Google Guice on Android(RoboGuice) 今天介绍一下Google的这个开源框架RoboGuice, 它的作用跟之前讲过的Dagger框架差点儿是一样的,仅仅是Dagger ...
- ArcGIS Runtime for Android开发教程V2.0(2)开发环境配置
原文地址: ArcGIS Runtime for Android开发教程V2.0(2)开发环境配置 - ArcGIS_Mobile的专栏 - 博客频道 - CSDN.NET http://blog.c ...
- Butter Knife使用详解
Butter Knife Github地址: https://github.com/JakeWharton/butterknife 官方说明给出的解释是 Bind Android views and ...
- Butter Knife 黄油刀
简介 Github:https://github.com/JakeWharton/butterknife 文档 特点: 采用注解的方式实现强大的View绑定和Click事件处理功能,简化代码,提升开 ...
- Butter Knife:一个安卓视图注入框架
Butter Knife:一个安卓视图注入框架 2014年5月8日 星期四 14:52 官网: http://jakewharton.github.io/butterknife/ GitHub地址: ...
随机推荐
- 【转】Linux安装方法一(U盘引导)
Ubuntu 13.04正式版已经在4月25日发布了,相信很多人和我一样很想安装体验一下,但是现在的Ubuntu 13.04文件已经是794M,但是很难刻录到一张CD中,所以采用U盘启动安装Ubunt ...
- IOS第二天多线程-04简化单例模式
******HMSingleton-ARC.h // .h文件 #define HMSingletonH(name) + (instancetype)shared##name; // .m文件 #de ...
- java常用工具类
http://www.cnblogs.com/langtianya/p/3875124.html
- 虚拟机设置静态ip
最近学习hadoop,用到虚拟机来做分布式,由于hadoop要配置slave节点的主机名,所以需要修改hosts文件的ip地址和主机名的映射关系. 但是虚拟机每次重启后,ip地址都会变 ,这样每次都得 ...
- PHP数据运算优先级总结记忆
运算符优先级
- 求解PDE的多重网格法(MG)
多重网格法相对于普通的Jacobi迭代或者G-S迭代等能够得到和未知数的个数成线性的高效运行时间的主要原因在于:迭代初值的一步步接近真值和G_S方法的前面几步的快速收敛性. 先看一张图[1]: 这张图 ...
- linq查询结果datetime类型转string类型
var list = new SupplierLogic().GetSupplier(pageSize, pageIndex).Select(q => new { SupplierID = q. ...
- LeetCode Read N Characters Given Read4
原题链接在这里:https://leetcode.com/problems/read-n-characters-given-read4/ 题目: The API: int read4(char *bu ...
- change和onchange触发为什么不立马生效?
change和onchange触发了,为什么不立马生效?那是因为他们本身不是当文本改变就立马触发的事件,而是当文本改变了,blur离开了表单才触发. 如果要加上触发请结合keyup,keydown,o ...
- JQuery1.11版本对prop和attr接口的含义分离导致问题分析
问题背景 实验中, 在jquery1.7版本, attr("value") 和 val() 接口获取 input 控件的值, 都是一致的, 都是当前控件值. 但是 jquery1 ...