問題:basequickadapter中setEmptyView設(shè)置了之后第一次加載沒問題,第二次加載就報(bào)錯(cuò):java.lang.IllegalStateException: ViewHolder views must not be attached when created. Ensure that you are not passing 'true' to the attachToRoot parameter of LayoutInflater.inflate(..., boolean attachToRoot)
解決辦法,在ondestroy的方法里面添加對(duì)adapter資源的釋放即可
代碼:
override fun onDestroy() {
super.onDestroy()
mBinding.rvBaseConsumeDetail.adapter = null
}