guaishouN / android-thinkmap-treeview

Tree View; Mind map; Think map; tree map; custom view; 自定义;关系图;树状图;思维导图;组织机构图;层次图
MIT License
475 stars 66 forks source link

能修改上下的间距吗 #22

Open wl532882877 opened 2 years ago

wl532882877 commented 2 years ago

整个树状图 上下的距离可以设置高度吗

guaishouN commented 2 years ago

使用View的padding应该可以

wl532882877 commented 2 years ago

使用View的padding应该可以

你好可不可以详细说明一下, 比如我现在在一个LinearLayout (orientation="vertical")里面写了一个 GysoTreeView(高度和宽度是自适应的),然后下面还有很多控件,但是GysoTreeView占的高度太高了,导致和下一个控件之间有一块很大的空白,这个空白就是 GysoTreeView的高度,能否有地方去设置GysoTreeView的总体高度呢

guaishouN commented 2 years ago

使用View的padding应该可以

你好可不可以详细说明一下, 比如我现在在一个LinearLayout (orientation="vertical")里面写了一个 GysoTreeView(高度和宽度是自适应的),然后下面还有很多控件,但是GysoTreeView占的高度太高了,导致和下一个控件之间有一块很大的空白,这个空白就是 GysoTreeView的高度,能否有地方去设置GysoTreeView的总体高度呢

在TreeViewContainer的onMeasure里ViewBox viewBox = mTreeLayoutManager.getTreeLayoutBox();为计算获得的树状图宽高,你可以在onMeasure里修改适应。 其中是这里生效 int specWidth = MeasureSpec.makeMeasureSpec(Math.max(winWidth, viewBox.getWidth()), MeasureSpec.EXACTLY); int specHeight = MeasureSpec.makeMeasureSpec(Math.max(winHeight,viewBox.getHeight()),MeasureSpec.EXACTLY);