Butter Knife
============
![Logo](website/static/logo.png)
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.
```java
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][3].
__Remember: A butter knife is like [a dagger][1] only infinitely less sharp.__
Download
--------
```groovy
dependencies {
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
}
```
Snapshots of the development version are available in [Sonatype's `snapshots` repository][snap].
Library projects
--------------------
To use Butter Knife in a library, add the plugin to your `buildscript`:
```groovy
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'
}
}
```
and then apply it in your module:
```groovy
apply plugin: 'com.android.library'
apply plugin: 'com.jakewharton.butterknife'
```
Now make sure you use `R2` instead of `R` inside all Butter Knife annotations.
```java
class ExampleActivity extends Activity {
@BindView(R2.id.user) EditText username;
@BindView(R2.id.pass) EditText password;
...
}
```
License
-------
Copyright 2013 Jake Wharton
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
[1]: http://square.github.com/dagger/
[2]: https://search.maven.org/remote_content?g=com.jakewharton&a=butterknife&v=LATEST
[3]: http://jakewharton.github.com/butterknife/
[snap]: https://oss.sonatype.org/content/repositories/snapshots/
没有合适的资源?快使用搜索试试~ 我知道了~
butterknife源码分析添加了详细注释
共852个文件
class:259个
xml:254个
java:158个
需积分: 14 20 下载量 58 浏览量
2017-03-08
11:35:39
上传
评论
收藏 18.9MB RAR 举报
温馨提示
本资源为截止到2017.3.8最新版ButterKnife源码分析,源码中添加了大量注释,如果你想了解ButterKnife实现原理,本资源很适合你。
资源推荐
资源详情
资源评论
收起资源包目录
butterknife源码分析添加了详细注释 (852个子文件)
proguard-android-optimize.txt-2.2.3 3KB
proguard-android.txt-2.2.3 3KB
butterknife-debug.aar 16KB
butterknife-release.aar 16KB
library-debug.aar 13KB
library-release.aar 13KB
ResultReceiver.aidl 675B
ResultReceiver.aidl 675B
resources-debug.ap_ 3KB
resources-debug.ap_ 3KB
resources-debug-androidTest.ap_ 3KB
resources-debug-androidTest.ap_ 759B
resources-debug-androidTest.ap_ 759B
resources-debug-androidTest.ap_ 756B
gradlew.bat 2KB
fileSnapshots.bin 1023KB
taskArtifacts.bin 481KB
fileSnapshotsToTreeSnapshotsIndex.bin 104KB
fileHashes.bin 78KB
localClassSetAnalysis.bin 20KB
localClassSetAnalysis.bin 20KB
localJarClasspathSnapshot.bin 19KB
localJarClasspathSnapshot.bin 19KB
ButterKnifeProcessor.class 43KB
BindingSet.class 27KB
BindViewTest.class 25KB
OnClickTest.class 20KB
UnbinderTest.class 17KB
BindViewsTest.class 15KB
OnItemClickTest.class 13KB
RClassTest.class 12KB
ButterKnife.class 12KB
ButterKnife.class 12KB
OnItemSelectedTest.class 10KB
BindArrayTest.class 8KB
ButterKnifeTest.class 8KB
BindColorTest.class 8KB
OnTextChangedTest.class 8KB
BindDrawableTest.class 7KB
Utils.class 7KB
Utils.class 7KB
BindDimenTest.class 6KB
BindingSet$Builder.class 6KB
ExtendDialogTest.class 5KB
ExtendViewTest.class 5KB
ExtendActivityTest.class 5KB
OnTouchTest.class 5KB
BindBitmapTest.class 5KB
OnLongClickTest.class 5KB
BindStringTest.class 4KB
BindBoolTest.class 4KB
BindIntTest.class 4KB
BindFloatTest.class 4KB
SimpleActivity_ViewBinding.class 4KB
FieldResourceBinding$Type.class 4KB
OnPageChangeTest.class 4KB
SimpleActivity_ViewBinding.class 4KB
SimpleActivity_ViewBinding.class 4KB
OnItemLongClickTest.class 4KB
OnEditorActionTest.class 4KB
OnCheckedChangedTest.class 4KB
InvalidR2UsageDetector$R2UsageVisitor.class 4KB
ViewBinding.class 3KB
OnFocusChangeTest.class 3KB
UtilsTest.class 3KB
SimpleActivity.class 3KB
SimpleActivity.class 3KB
SimpleActivity.class 3KB
TestGeneratingProcessor.class 3KB
InvalidR2UsageDetector.class 3KB
SimpleAdapter.class 3KB
SimpleAdapter.class 3KB
ButterKnifeProcessor$IdScanner.class 3KB
FieldCollectionViewBinding.class 3KB
ButterKnifeProcessor$VarScanner.class 3KB
SimpleAdapter.class 3KB
ViewBinding$Builder.class 3KB
G_ViewBinding.class 2KB
ButterKnifeProcessor$RClassScanner.class 2KB
SimpleActivityTest.class 2KB
A_ViewBinding.class 2KB
UnbinderTest.class 2KB
C_ViewBinding.class 2KB
H_ViewBinding.class 2KB
B_ViewBinding.class 2KB
FieldResourceBinding.class 2KB
G_ViewBinding.class 2KB
Id.class 2KB
SimpleAdapterTest.class 2KB
E_ViewBinding.class 2KB
D_ViewBinding.class 2KB
SimpleAdapter$ViewHolder_ViewBinding.class 2KB
SimpleAdapter$ViewHolder_ViewBinding.class 2KB
SimpleAdapter$ViewHolder_ViewBinding.class 2KB
FieldDrawableBinding.class 2KB
C_ViewBinding.class 2KB
F_ViewBinding.class 2KB
H_ViewBinding.class 2KB
MethodViewBinding.class 2KB
SimpleActivity_ViewBinding$3.class 1KB
共 852 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
刘永雷
- 粉丝: 22
- 资源: 81
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功