android butterknife zelezny 怎么使用
2个回答
2016-10-30 · 知道合伙人教育行家
关注
展开全部
android butterknife zelezny用法:
一,配置butterknife
Configure your project-level build.gradle to include the 'android-apt' plugin:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
Then, apply the 'android-apt' plugin in your module-level build.gradle and add the Butter Knife dependencies:
apply plugin: 'android-apt'
android {
...
}
dependencies {
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
}
二,安装ButterKnifeZelezny插件
File -> Seting -> Plugins -> Browser Responsities ->Butterknife Zelezny
三,使用插件时xml中的布局写法
public class MainListActivity extends AppCompatActivity {
@BindView(R.id.marquee_tv)
TextView mMarqueeTv;
@BindView(R.id.more_tv)
TextView mMoreTv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_list);
ButterKnife.bind(this);
}
@OnClick({R.id.marquee_tv, R.id.more_tv})
public void onClick(View view) {
switch (view.getId()) {
case R.id.marquee_tv:
break;
case R.id.more_tv:
break;
}
}
}
一,配置butterknife
Configure your project-level build.gradle to include the 'android-apt' plugin:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
Then, apply the 'android-apt' plugin in your module-level build.gradle and add the Butter Knife dependencies:
apply plugin: 'android-apt'
android {
...
}
dependencies {
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
}
二,安装ButterKnifeZelezny插件
File -> Seting -> Plugins -> Browser Responsities ->Butterknife Zelezny
三,使用插件时xml中的布局写法
public class MainListActivity extends AppCompatActivity {
@BindView(R.id.marquee_tv)
TextView mMarqueeTv;
@BindView(R.id.more_tv)
TextView mMoreTv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_list);
ButterKnife.bind(this);
}
@OnClick({R.id.marquee_tv, R.id.more_tv})
public void onClick(View view) {
switch (view.getId()) {
case R.id.marquee_tv:
break;
case R.id.more_tv:
break;
}
}
}
Storm代理
2023-07-25 广告
2023-07-25 广告
StormProxies是一家可靠的代理服务提供商,提供原生IP(住宅原生IP)和高匿名代理服务。以下是关于StormProxies的原生IP服务的一些信息:1. 住宅原生IP:StormProxies提供的住宅原生IP是指从真实的家庭或企...
点击进入详情页
本回答由Storm代理提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询