1,第一步: 下载butterknife插件并重启AndroidStudio
2,第二步: 添加依赖
在model中的dependencies添加两行代码:
implementation 'com.jakewharton:butterknife:8.7.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
3,第三步:代码中使用
光标放在布局id上,右键generate
在弹出的下拉框中选择带煎蛋图标的点击进去
选择你需要findViewById的控件,Confirm就可以了