1

I was in process of converting a java project to kotlin when I encountered this strange behavior.

in Java:

new ImageSwitcher.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

works fine.

but in kotlin it gives me compile error:

ImageSwitcher.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)


LayoutParams is an inner class in `FrameLayout` which is the parent of `ImageSwitcher`

enter image description here

I know I can solve it by using FrameLayout.LayoutParams but why the original code is not working?

humazed
  • 74,687
  • 32
  • 99
  • 138

1 Answers1

1

There is no static inheritance in kotlin, and i guess this is the right way to go because static inheritance may lead to ambigous errors.

Samuel Eminet
  • 4,647
  • 2
  • 18
  • 32
  • thank you, you pointed me in the right direction. I found this excellent answer https://stackoverflow.com/q/39303180/3998402 – humazed Apr 13 '18 at 13:49