kotlin在fragment中不能像activity中直接通过id调用控件的解决方法

不能直接用id的原因,是因为你的xml没有载入,会导致使用id的时候会报空指针,如果需要使用,在onCreateView return view后,在onViewCreate函数中使用Id直接调用,onViewCreate会在onCreateView后执行

猜你喜欢

转载自blog.csdn.net/villa_mou/article/details/78918797