mViewBinding.getRoot().getContext()
时间: 2023-12-23 11:05:20 浏览: 137
mViewBinding.getRoot().getContext()返回的是mViewBinding的根视图所在的上下文。在引用\[1\]中的代码中,mViewBinding是通过ActivityMainBinding.inflate(getLayoutInflater())来实例化的,而ActivityMainBinding是由ViewBinding生成的一个类。所以mViewBinding.getRoot()返回的是根视图,而mViewBinding.getRoot().getContext()返回的是该根视图所在的上下文。
#### 引用[.reference_title]
- *1* *2* [ViewBinding的用法](https://blog.csdn.net/qq_36570506/article/details/129214841)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [Android ViewBinding 在RecyclerView.ViewHolder 中的使用](https://blog.csdn.net/vistaup/article/details/126104137)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文