问题:
滚动视图不显示是上下文未写错
解决:
在fragment
var adater = UsbDeviceListAdapter(usbList)
binding?.usbDeviceList?.adapter = adater
binding?.usbDeviceList?.layoutManager = LinearLayoutManager(activity)
对应activity的值就是
final public FragmentActivity getActivity() {
return mHost == null ? null : (FragmentActivity) mHost.getActivity();}
在activity里上下文
var adapter = OrderListAdapter(orderList)
binding?.ordersview!!.adapter = adapter
binding?.ordersview?.layoutManager = LinearLayoutManager(this)