android(android studio)中使用注解框架butterknife
2016-01-16 15:34
666 查看
使用butterknife的原因是 当一个布局文件中组件太多的时候 就需要我们去写很多重复的代码 所以butterknife能够帮助我们减少一定的(无用的)代码量
1.android studio安装插件
首先点击File ->setting ->plugins
然后再新的对话框搜索butterknife 我这个是已经安装 点击install 会重启android Studio 然后就可以使用了
2.添加依赖
在build.gradle 添加依赖
3.使用
在需要写findViewById()这样的activity或者fragment中 对着R.layout.xxx右键 点击 generate 会有butterknife 点击 就出现了 然后修改自己想要的名称就行
相关链接:
butterknife Github地址 http://jakewharton.github.io/butterknife/
1.android studio安装插件
首先点击File ->setting ->plugins
然后再新的对话框搜索butterknife 我这个是已经安装 点击install 会重启android Studio 然后就可以使用了
2.添加依赖
在build.gradle 添加依赖
compile 'com.jakewharton:butterknife:7.0.0'
3.使用
在需要写findViewById()这样的activity或者fragment中 对着R.layout.xxx右键 点击 generate 会有butterknife 点击 就出现了 然后修改自己想要的名称就行
相关链接:
butterknife Github地址 http://jakewharton.github.io/butterknife/
相关文章推荐
- android studio preference 在哪
- java自带线程池和队列详细讲解,android中适用
- android 服务
- Android 自定义设置图片模糊度、高斯模糊效果
- Android真机连接本地服务器测试
- android 检测sqlite数据表中字段(列)是否存在
- Android版本升级同时Sqlite数据库的升级及之前数据的保留-转
- 新出炉的Android Studio快捷键
- 表白程序源代码,android
- android studio的里的 content_XXX_xml问题
- 在脚本中, 使用sqlite3检查android程序生成的数据库是否OK
- 【Android源码-AMS】(一)Instrumentation类解析
- Android Support V4, V7, V13的作用与用法
- android 启动子线程
- android stdio 导入类库出错
- android 中的IPC方式
- Android4.0.3 USB OTG底层插入上报过程分析(1)
- Android客服端, 服务器和数据库简单交互之获取图片
- Android4.0.3 USB OTG底层插入上报过程分析(1)
- android程序在真机上运行无法显示所有LogCat信息问题解决