Name: butterknife
Owner: Alibaba
Description: Bind Android views and callbacks to fields and methods.
Forked from: JakeWharton/butterknife
Created: 2017-04-05 07:06:12.0
Updated: 2018-04-05 15:42:10.0
Pushed: 2017-03-13 00:24:02.0
Homepage: http://jakewharton.github.io/butterknife/
Size: 3383
Language: Java
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Field and method binding for Android views which uses annotation processing to generate boilerplate code for you.
findViewById
calls by using @BindView
on fields.@OnClick
and others.s ExampleActivity extends Activity {
indView(R.id.user) EditText username;
indView(R.id.pass) EditText password;
indString(R.string.login_error) String loginErrorMessage;
nClick(R.id.submit) void submit() {
// TODO call server...
verride 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.
ndencies {
mpile 'com.jakewharton:butterknife:8.5.1'
notationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
Snapshots of the development version are available in Sonatype's snapshots
repository.
To use Butter Knife in a library, add the plugin to your buildscript
:
dscript {
positories {
mavenCentral()
pendencies {
classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'
and then apply it in your module:
y plugin: 'com.android.library'
y plugin: 'com.jakewharton.butterknife'
Now make sure you use R2
instead of R
inside all Butter Knife annotations.
s ExampleActivity extends Activity {
indView(R2.id.user) EditText username;
indView(R2.id.pass) EditText password;
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.