Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bmelnychuk/AndroidTreeView
AndroidTreeView. TreeView implementation for android
https://github.com/bmelnychuk/AndroidTreeView
Last synced: about 2 months ago
JSON representation
AndroidTreeView. TreeView implementation for android
- Host: GitHub
- URL: https://github.com/bmelnychuk/AndroidTreeView
- Owner: bmelnychuk
- License: apache-2.0
- Created: 2015-02-11T02:48:05.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2022-02-09T07:25:31.000Z (almost 3 years ago)
- Last Synced: 2024-10-15T10:06:21.947Z (about 2 months ago)
- Language: Java
- Homepage:
- Size: 232 KB
- Stars: 2,998
- Watchers: 84
- Forks: 620
- Open Issues: 117
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- -awesome-android-ui - AndroidTreeView - 2.0) | <img src="/art/AndroidTreeView.webp" width="49%"> <img src="/art/AndroidTreeView2.webp" width="49%"> (Index `(light-weight pages)`)
- awesome-android-ui - AndroidTreeView - 2.0) | <img src="/art/AndroidTreeView.webp" width="49%"> <img src="/art/AndroidTreeView2.webp" width="49%"> (Index `(light-weight pages)`)
- awesome-github-android-ui - AndroidTreeView - 安卓的目录视图 (TreeView)
- awesome-android-ui - AndroidTreeView - 2.0) | <img src="/art/AndroidTreeView.webp" width="49%"> <img src="/art/AndroidTreeView2.webp" width="49%"> (Index)
- awesome-android-ui - https://github.com/bmelnychuk/AndroidTreeView
- awesome-android-ui - https://github.com/bmelnychuk/AndroidTreeView
README
## This project is deprecated. You can still use it as it. Let me know if someone is interested in supporting it.
AndroidTreeView
====================### Recent changes
2D scrolling mode added, keep in mind this comes with few limitations: you won't be able not place views on right side like alignParentRight. Everything should be align left. Is not enabled by default
### Description
Tree view implementation for android
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-AndroidTreeView-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1534)
### Demo
[![AndroidTreeView Demo on Google Play Store](http://style.anu.edu.au/_anu/images/icons/icon-google-play-small.png)](https://play.google.com/store/apps/details?id=com.unnamed.b.atv.demo)
### Features
+ 1. N - level expandable/collapsable tree
+ 2. Custom values, views, styles for nodes
+ 3. Save state after rotation
+ 4. Selection mode for nodes
+ 5. Dynamic add/remove node### Known Limitations
+ For Android 4.0 (+/- nearest version) if you have too deep view hierarchy and with tree its easily possible, your app may crash
### Integration
**1)** Add library as a dependency to your project
```compile 'com.github.bmelnychuk:atv:1.2.+'```
**2)** Create your tree starting from root element. ```TreeNode.root()``` element will not be displayed so it doesn't require anything to be set.
```java
TreeNode root = TreeNode.root();
```Create and add your nodes (use your custom object as constructor param)
```java
TreeNode parent = new TreeNode("MyParentNode");
TreeNode child0 = new TreeNode("ChildNode0");
TreeNode child1 = new TreeNode("ChildNode1");
parent.addChildren(child0, child1);
root.addChild(parent);
```**3)** Add tree view to layout
```java
AndroidTreeView tView = new AndroidTreeView(getActivity(), root);
containerView.addView(tView.getView());
```
The simplest but not styled tree is ready. Now you can see ```parent``` node as root of your tree**4)** Custom view for nodes
Extend ```TreeNode.BaseNodeViewHolder``` and overwrite ```createNodeView``` method to prepare custom view for node:
```java
public class MyHolder extends TreeNode.BaseNodeViewHolder {
...
@Override
public View createNodeView(TreeNode node, IconTreeItem value) {
final LayoutInflater inflater = LayoutInflater.from(context);
final View view = inflater.inflate(R.layout.layout_profile_node, null, false);
TextView tvValue = (TextView) view.findViewById(R.id.node_value);
tvValue.setText(value.text);
return view;
}
...
public static class IconTreeItem {
public int icon;
public String text;
}
}
```**5)** Connect view holder with node
```java
IconTreeItem nodeItem = new IconTreeItem();
TreeNode child1 = new TreeNode(nodeItem).setViewHolder(new MyHolder(mContext));
```**6)** Consider using
```java
TreeNode.setClickListener(TreeNodeClickListener listener);
AndroidTreeView.setDefaultViewHolder
AndroidTreeView.setDefaultNodeClickListener
...
```For more details use sample application as example
Let me know if i missed something, appreciate your support, thanks!
### Projects using this library
[Blue Dot : World Chat](https://play.google.com/store/apps/details?id=com.commandapps.bluedot)