Forcelayout
项目地址:
Forcelayout
简介:Forcelayout is library for android. You can drawing graph with spring-like attractive forces.
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);