在自定义类中使用Kotlin android扩展

在自定义类中使用Kotlin android扩展,android,kotlin,Android,Kotlin,编辑 我在用kotlin做我的项目 尤其是Kotlin android扩展 当活动或片段没有问题时 我想在自定义类中使用此功能。(不带experitemtal layoutContainer) 现在我通过这种方式使用扩展 // some class // pass rootView val nameTextView1 by lazy {rootView.tv_name1} val nameTextView2 by lazy {rootView.tv_name2} val nameTextVi

编辑

我在用kotlin做我的项目

尤其是Kotlin android扩展

当活动或片段没有问题时

我想在自定义类中使用此功能。(不带experitemtal layoutContainer)

现在我通过这种方式使用扩展

// some class 
// pass rootView 
val nameTextView1 by lazy {rootView.tv_name1}
val nameTextView2 by lazy {rootView.tv_name2}
val nameTextView3 by lazy {rootView.tv_name3}
val nameTextView4 by lazy {rootView.tv_name4}
val nameTextView5 by lazy {rootView.tv_name5}
有人知道什么奇特的方法吗?
我想删除“rootView”的重复项。有什么想法吗?

你说的幻想是什么意思?这只是一行少于50个字符的代码,你还期待什么?我简直无法理解你的问题。这里也是。我不明白。