版权声明:随便转都是学别人的 https://blog.csdn.net/weixin_35691921/article/details/84971241
事例:
第一步:添加依赖
//butterknife
implementation 'com.jakewharton:butterknife:8.4.0'
api 'com.jakewharton:butterknife-compiler:8.4.0'
第二步:布局
…
第三步:一键生成
↓
@BindView(R.id.fragment_audio_iv_btn_back)
ImageView fragmentAudioIvBtnBack;
...
生成方法(需要下载AS插件):
鼠标放在布局文件上,下面代码里 fragment_audio 上.
按 alt + insert ,会弹出提示框
提示框中
点击黄色框的选项即可。