Skip to content

fragment中销毁binding时机 #61

@wumeixinjiazu

Description

@wumeixinjiazu

不建议这么使用
thisRef.viewLifecycleOwner.lifecycle.addObserver(object : LifecycleObserver {
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
fun onDestroyView() {
Log.e("taggg", "onDestroyView viewLifecycleOwner$this")
_binding = null
}
})
因为这会导致比fragment更快的执行onDestroyView方法

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions