Android一键实例化控件及监听插件「ButterKnife」的简介及使用
2017-03-09 00:27
459 查看
概述
通过java注解一键实例化控件及监听,大大减少反复findViewById()和setonclicktListener()的无脑工作量。简化代码量,提高可读性,且对程序性能的影响微乎其微。
源码:https://github.com/JakeWharton/butterknife
使用
1. 安装插件,Settings --- Plugins --- Browse repositories --- 搜索Android ButterKnife Zelezny--- Install --- 重启AS
2. 在app的build.gradle中添加如下代码 --- Sync Now
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } apply plugin: 'com.neenbedankt.android-apt' dependencies { compile 'com.jakewharton:butterknife:8.5.1' apt 'com.jakewharton:butterknife-compiler:8.5.1' }
3. 光标置于布局文件名上 --- Alt+Insert
最终效果
相关文章推荐
- Android Studio上方便使用butterknife注解框架的偷懒插件Android Butterknife Zelezny
- Android Studio上方便使用butterknife注解框架的偷懒插件Android Butterknife Zelezny
- Android 注解ButterKnife绑定控件使用指南
- Android Studio自动生成控件Id插件的使用--findViewById自动化
- Android studio插件使用----android-butterknife-zelezny
- Android ButterKnife Zelezny插件的安装与使用(可视化一键生成)
- butterknife和对应插件android butterknife zelezny的使用详细记录
- Android Studio上方便使用butterknife注解框架的偷懒插件Android Butterknife Zelezny
- CAD控件,CAD插件使用教程:Android开发使用控件--开发环境的搭建
- (奶油小刀插件) android-butterknife-zelezny 插件使用
- Android Studio上方便使用butterknife注解框架的偷懒插件Android Butterknife Zelezny(转)
- Android Studio上方便使用butterknife注解框架的偷懒插件Android Butterknife Zelezny
- Android Studio上方便使用butterknife注解框架的偷懒插件Android Butterknife Zelezny
- Android 给Fragment中的控件添加监听及使用intent
- Android控件:ScrollView的使用,滑动到底部的监听
- Android Studio上方便使用butterknife注解框架的偷懒插件Android Butterknife Zelezny
- (2016.5.26更新8.0.1失效问题)Android Studio上使用Butterknife注解框架与插件Android Butterknife Zelezny
- Android-butterKnife的使用及Zelezny插件的安装
- Android Studio上方便使用butterknife注解框架的偷懒插件Android Butterknife Zelezny