When you use a included layout
<include android:id="@+id/included" layout="@layout/content_fft"/>
and use
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_record)
but it builds and runs properly .
Does anyone has a clue how to get rid of it. It's very annoying because Android Studio shows me a lot of errors.
To demonstrate the error, I made a demo repo https://github.com/hannesa2/AndroidBinding3.2
mBinding的类型错误,应为ActivityRecordBinding。
private lateinit var mBinding: ActivityRecordBinding
Just be sure if your layout file name is in snake_case then your binding class name would be in CamelCase .
Layout Name is activity_main.xml
Binding class name would be ActivityMainBinding.class
So your binding class name will be ActivityRecordBinding
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.