如何在 kotlin 中将数据绑定(bind)与底部工作表对话框一起使用。我在使用底部工作表对话框的数据绑定(bind)时遇到问题
最佳答案
我通过将底部工作表转换为数据绑定(bind)解决了这个问题,如下所示:
bottom_sheet_pick_loc.xml
<layout >
.....
</layout >
In Activity or Fragment:
val bottomSheet = BottomSheetDialog(this@MainActivity)
val bindingSheet = DataBindingUtil.inflate<BottomSheetPickLocBinding>(
layoutInflater,
R.layout.bottom_sheet_pick_loc,
null,
false
)
bottomSheet.setContentView(bindingSheet.root)
关于android - 使用 kotlin 在 android 中与底部工作表进行数据绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60531910/