Kotlin继承类实现抽象方法报错“kotlin.NotImplementedError: An operation is not implemented: not implemented”

    override fun initLayoutRes(): Int {
//        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
        return R.layout.activity_kotlin_test_layout
    }

删除掉默认实现即可。

kotlin中‘TODO’为默认实现,与'return 0'等同,如果自己实现需要删除默认的‘TODO’;

猜你喜欢

转载自blog.csdn.net/sunlit_6/article/details/80819416