android-thinkmap-treeview
android-thinkmap-treeview copied to clipboard
请问如何自定义初始化缩放大小,是否开启移动的功能
编程语言是kotlin,目前初始化生成的思维导图很小,大概缩放比是50%。
初始化主要思想是将整个图都显示出来。可以截个图看看
public void setScalePercentAndCenterY(float scalePercent){ float[] centerM = new float[9]; if(centerMatrix==null){ TreeViewLog.e(TAG, "no centerMatrix!!!"); return; } centerMatrix.getValues(centerM); float[] now = new float[9]; getMatrix().getValues(now); TreeViewLog.e(TAG, "setScalePercent: \n" + Arrays.toString(centerM)+"\n" + Arrays.toString(now)); centerM[Matrix.MSCALE_X] = scalePercent; centerM[Matrix.MSCALE_Y] = scalePercent; TreeViewLog.e("测量高度",getHeight()+""); float centerY = (getScreenHeight() - getMeasuredHeight()) / 2f * scalePercent; if(now[Matrix.MSCALE_X]>0&&now[Matrix.MSCALE_Y]>0){ animate() .scaleX(centerM[Matrix.MSCALE_X]) .translationX(0f) .scaleY(centerM[Matrix.MSCALE_Y]) .translationY(centerY) .setDuration(DEFAULT_FOCUS_DURATION) .start(); } } 在TreeViewContainer里面加个方法 我这里是设置缩放比例和Y轴居中 不要Y轴居中的话可以把translationY删了