每天记录学习的知识:butterknife

版权声明:随便转都是学别人的 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 ,会弹出提示框

提示框中
在这里插入图片描述
点击黄色框的选项即可。

猜你喜欢

转载自blog.csdn.net/weixin_35691921/article/details/84971241