Forcelayout
项目地址:
Forcelayout
![收藏,GitHub 同步 Star](https://i-blog.csdnimg.cn/blog_migrate/7d0234f6040bfebfea82f8d6092495f1.png)
简介:Forcelayout is library for android. You can drawing graph with spring-like attractive forces.
![image](https://i-blog.csdnimg.cn/blog_migrate/49411ad8ab5c1caeb1d8784f4dca9c15.gif)
![image](https://i-blog.csdnimg.cn/blog_migrate/49411ad8ab5c1caeb1d8784f4dca9c15.gif)
Usage
1. Gradle
repositories {
jcenter()
}
dependencies {
compile 'jp.kai:forcelayout:1.0.3'
}
2. Definitions of nodes
HashMap<String, Integer> nodes = new HashMap<>();
nodes.put("labelname_1",R.drawable.example1);
nodes.put("labelname_2",R.drawable.example2);
3. Definitions of links
List<String> links = new ArrayList<String>();
links.put("labelname_1-labelname_2");
4. Set nodes and links
You can set node's size and linkstrength, and so on.
Forcelayout.with(this)
.nodesize(200)
.linkStrength(0.1)
.distance(200)
.gravity(0.04)
.nodes(nodes)
.links(links);