All Projects → LeeReindeer → Tree2view

LeeReindeer / Tree2view

Licence: apache-2.0
🎄 Tree data structure to Android View

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Tree2view

Ete
Python package for building, comparing, annotating, manipulating and visualising trees. It provides a comprehensive API and a collection of command line tools, including utilities to work with the NCBI taxonomy tree.
Stars: ✭ 506 (+103.21%)
Mutual labels:  treeview
Vuetify Draggable Treeview
Vuetify draggable v-treeview component
Stars: ✭ 51 (-79.52%)
Mutual labels:  treeview
Expandablerecyclerview
ExpandableRecyclerView with smoothly animation.
Stars: ✭ 135 (-45.78%)
Mutual labels:  treeview
Zfvimdirdiff
vim script to diff two directories like BeyondCompare by using `diff`
Stars: ✭ 22 (-91.16%)
Mutual labels:  treeview
Historicprocesstree
An Incident Response tool that visualizes historic process execution evidence (based on Event ID 4688 - Process Creation Event) in a tree view.
Stars: ✭ 46 (-81.53%)
Mutual labels:  treeview
Ngx Tree Select
Angular select component with tree items
Stars: ✭ 59 (-76.31%)
Mutual labels:  treeview
React Checkbox Tree
A simple and elegant checkbox tree for React.
Stars: ✭ 477 (+91.57%)
Mutual labels:  treeview
Vuejs Tree
A highly customizable and blazing fast Vue tree component ⚡🌲
Stars: ✭ 211 (-15.26%)
Mutual labels:  treeview
Hummingbird Treeview
A powerful and fast jQuery treeview plugin
Stars: ✭ 50 (-79.92%)
Mutual labels:  treeview
Pbtreeview
An UITreeView implementation from UITableView that Apple missed in its UIKit framework. And it is in pure Swift.
Stars: ✭ 128 (-48.59%)
Mutual labels:  treeview
Graphview
Android GraphView is used to display data in graph structures.
Stars: ✭ 918 (+268.67%)
Mutual labels:  treeview
Angular Tree Component
A simple yet powerful tree component for Angular (>=2)
Stars: ✭ 1,031 (+314.06%)
Mutual labels:  treeview
Vue Finder
📁 A Vue.js component to display hierarchical data (like the MacOS X finder)
Stars: ✭ 87 (-65.06%)
Mutual labels:  treeview
Dbkoda
State of the art MongoDB IDE
Stars: ✭ 795 (+219.28%)
Mutual labels:  treeview
Graphview
Flutter GraphView is used to display data in graph structures. It can display Tree layout, Directed and Layered graph. Useful for Family Tree, Hierarchy View.
Stars: ✭ 152 (-38.96%)
Mutual labels:  treeview
Folder Explorer
分析文件目录,统计数据并以树形结构和图表的形式展示结果,也可以导出多种格式留存
Stars: ✭ 479 (+92.37%)
Mutual labels:  treeview
Bootstraptable Treeview
bootstrapTable extension of treeView
Stars: ✭ 57 (-77.11%)
Mutual labels:  treeview
You Dont Need Javascript
CSS is powerful, you can do a lot of things without JS.
Stars: ✭ 16,514 (+6532.13%)
Mutual labels:  treeview
Noodel Js
User interface for responsive, dynamic content trees
Stars: ✭ 173 (-30.52%)
Mutual labels:  treeview
Wmztreeview
类似前端elementUI的树形控件,可自定义节点内容,支持无限极节点,可拖拽增删节点等等,非递归实现
Stars: ✭ 118 (-52.61%)
Mutual labels:  treeview

Tree2View

TreeView implementation in Android.Now available on Jitpack🎉

中文版

Features

TreeView File Explorer(Advanced Example)
①Multi-level tree view Basic file manager layout
②Remember expansion state Automatically expand the last unclosed directory
③Customize TreeAdapter Different types of documents show different Icon
④Dynamic add and delete nodes refresh status after delete and add files
⑤Select listener Long press node for file operations (Copy, Cut, Rename, Delete)
⑥Animation support Add or delete files with animation

You can also see a more simple example.

Implement

  • TreeView extends from ListView.

  • DFS travel the expandable tree node, and convert it to List which adapt with TreeAdapter.

  • Use SimpleTreeAdapter ot set different indentation on nodes of different depths.

  • Use LinkedList to store node's children, see DefaultTreeNode.

Preview

Download

  1. Add it in your root build.gradle at the end of repositories:
	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
  1. Add the dependency
	dependencies {
	        implementation 'com.github.LeeReindeer:Tree2View:v0.1.2'
	}

Usage

  1. Add in your xml:

Feel free to use it as ListView.

    <moe.leer.tree2view.TreeView
        android:id="@+id/tree_view"
        android:layout_marginTop="16dp"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:divider="#ffffff"
        android:dividerHeight="1px">

    </moe.leer.tree2view.TreeView>
  1. Add children in Kotlin code(Java is similar whit it)
  var root :DefaultTreeNode? = DefaultTreeNode("Root")
  tree_view.root = root
  val child1 = DefaultTreeNode("Child1")
  val child2 = DefaultTreeNode("Child2")
  // After create a node your should immediately add it.
  root.addChild(child1)
  root.addChild(child2)
  val child3 = DefaultTreeNode("Child3")
  child1.addChild(child3)
  //whether the root's children is expanded by default
  tree_view.isRootVisible = true
  //animation
  tree_view.isDefaultAnimation = true
  1. Add click listener and select listener

Tree2View has a default click listener, but it's ok to add your own.You can refer to here.

  1. If you want to use customized item view, you should implement TreeAapater, like this:
public class FileTreeAdapter extends TreeAdapter<FileItem> {
  //resourceId is your customized view resourceId, please use RelativeLayout, and let view neighbour.
  public FileTreeAdapter(Context context, DefaultTreeNode root, int resourceId) {
    super(context, root, resourceId);
  }
  
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
     //your code here
     //...
     //call padding for a better UI
     setPadding(holder.arrowIcon, depth, -1);
     //toggle your view's status here
     toggle(node, holder);
    }
    
    @Override
     public void toggle(Object... objects) {
     }

Then simply add:

  val adapter = FileTreeAdapter(this@MainActivity, root, R.layout.layout_file_tree_item)
  treeView.treeAdapter = adapter

License

Apache 2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].