diff --git a/JetpackMvvm/src/main/java/me/hgj/jetpackmvvm/base/activity/BaseVmActivity.kt b/JetpackMvvm/src/main/java/me/hgj/jetpackmvvm/base/activity/BaseVmActivity.kt index f4325b9..11663bb 100644 --- a/JetpackMvvm/src/main/java/me/hgj/jetpackmvvm/base/activity/BaseVmActivity.kt +++ b/JetpackMvvm/src/main/java/me/hgj/jetpackmvvm/base/activity/BaseVmActivity.kt @@ -10,6 +10,7 @@ import me.hgj.jetpackmvvm.ext.getVmClazz import me.hgj.jetpackmvvm.ext.util.notNull import me.hgj.jetpackmvvm.network.manager.NetState import me.hgj.jetpackmvvm.network.manager.NetworkStateManager +import androidx.lifecycle.ViewTreeLifecycleOwner /** * 作者 : hegaojian @@ -30,6 +31,7 @@ abstract class BaseVmActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + ViewTreeLifecycleOwner.set(window.decorView, this) initDataBind().notNull({ setContentView(it) }, { @@ -102,4 +104,4 @@ abstract class BaseVmActivity : AppCompatActivity() { open fun initDataBind(): View? { return null } -} \ No newline at end of file +}