DylanCaiCoding / LoadingStateView

Decoupling the code of toolbar or loading status view. (深度解耦标题栏,解耦加载中、加载失败、无数据等缺省页,支持两行代码集成到基类)
Apache License 2.0
676 stars 53 forks source link

setHeaders throw You must call removeView() on the child's parent first. #28

Closed aheven closed 2 years ago

aheven commented 2 years ago

我的Activity继承于BaseBindingActivity,但是当我调用如下方法时,抛出The specified child already has a parent. You must call removeView() on the child's parent first.错误,请问有什么解决方案吗?

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    setHeaders(HeadViewDelegate(),HeadViewDelegate())
}
aheven commented 2 years ago

我不知道为什么setHeads()中获取的view总是同一个:

image

aheven commented 2 years ago

最终发现每个ViewDelegate需要不同的ViewType