现在butterknife 不好用了,要使用viewBinding 了
刚开始和这个妹子打交道,还不是很熟悉,
先来一发
首先在buide.gradle 里面的android 下添加viewBinding{ enable= true}
添加后写的layout xml 会自动生成layoutBinding
比如 我写了一个base_title.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:id="@+id/layoutTitle" android:layout_height="@dimen/title_height"> <ImageView android:id="@+id/iv_left_back" android:layout_width="wrap_content" android:layout