思维导图布局的前身是树形布局,对树形布局基本使用还不太了解的朋友可以先看看我写的树形布局系列教程,了解了树形布局的使用方法后再来阅读本文章。
先睹为快
来看看效果吧,横向效果如下:

纵向效果如下:(布局可拖拽,后面会讲解)

基本使用
首先导入库。
allprojects {
repositories {
...
maven {
url 'https://jitpack.io'
}
}
}
dependencies {
implementation 'com.github.PYJTLK:MindMapViewTest:1.2'
}
为了方便讲解,下面来实现如下的效果,先写布局代码。

注意下面的代码,MindMapLayout是思维导图布局,TreeLayout是树形布局。一定要按照如下的方式摆放,否则会报错。
左树 + 根 + 右树 或者 上树 + 根 + 下树
app:orientation决定思维导图的方向
app:mapLocked锁定思维导图,后面会讲它的作用
<com.pyjtlk.widget.MindMapLayout
android:id="@+id/mindMapLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#A0A0"
app:orientation="horizontal"
app:mapLocked="false">
<!--左树-->
<com.pyjtlk.widget.TreeLayout
android:id="@+id/treeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:treeDirection="downToUp"
app:levelInterval="50dp">
<Button
android:layout_width="80dp"
android:layout_height="40dp"
android:text="Node"/>
<Button
android:layout_width="80dp"
android:layout_height="40dp"
android:text

最低0.47元/天 解锁文章
1362





