在父级中调用 inner class 在 kotlin 中不起作用
Calling inner class in the parent not working in kotlin
当我遇到这种奇怪的行为时,我正在将一个 java 项目转换为 kotlin。
在 Java 中:
new ImageSwitcher.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
工作正常。
但在 kotlin 中它给我编译错误:
ImageSwitcher.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
LayoutParams is an inner class in `FrameLayout` which is the parent of `ImageSwitcher`
我知道我可以使用 FrameLayout.LayoutParams
但为什么原始代码不起作用?
kotlin 中没有静态继承,我想这是正确的方法,因为静态继承可能会导致模棱两可的错误。
当我遇到这种奇怪的行为时,我正在将一个 java 项目转换为 kotlin。
在 Java 中:
new ImageSwitcher.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
工作正常。
但在 kotlin 中它给我编译错误:
ImageSwitcher.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
LayoutParams is an inner class in `FrameLayout` which is the parent of `ImageSwitcher`
我知道我可以使用 FrameLayout.LayoutParams
但为什么原始代码不起作用?
kotlin 中没有静态继承,我想这是正确的方法,因为静态继承可能会导致模棱两可的错误。