owant / ThinkMap

在 Android 上绘制思维导图控件,让思维更简单。
Apache License 2.0
346 stars 82 forks source link

TreeView#网络获取数据后显示导致异常onMeasure() did not set the measured dimension by calling setMeasuredDimension() #15

Closed hanouba closed 5 years ago

hanouba commented 5 years ago

TreeView#onMeasure() did not set the measured dimension by calling setMeasuredDimension() 如果采取网络请求,后加载数据显示页面,就会导致上面的错误,该如何避免?

owant commented 5 years ago

已经修复了

owant commented 5 years ago
    if (mTreeLayoutManager != null && mTreeModel != null) {
        //树形结构的分布
        mTreeLayoutManager.onTreeLayout(this);
        ViewBox viewBox = mTreeLayoutManager.onTreeLayoutCallBack();
        setMeasuredDimension(viewBox.right + Math.abs(viewBox.left), viewBox.bottom + Math.abs(viewBox.top));

        boxCallBackChange();
    } else {//对于空的情况进行设置一个默认的大小
        setMeasuredDimension(widthMeasureSpec, heightMeasureSpec);
    }