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
<br>
<br>
<img width='300' hspace='20' align='left' src='https://lh4.ggpht.com/xzkb3N58LH2Tsb_gGs0u3_x81VOLwlhcp-f4pz_sR_iR3vAKXfJoAcwBjN74LvzpVLE=h900-rw' />
<img width='300' hspace='20' src='https://lh5.ggpht.com/Ut6By_iUnkNfzIbaPBsc8hBeQeFj_2UXJh_1tfwDdlTAqGkhiR72A_AwQ0L0GH3OFag=h900-rw' />
<img width='300' hspace='20' src='https://www.dropbox.com/s/nc6q4jubaau0x5m/Screenshot_2015-02-15-23-16-56.png?dl=1' />
<img width='300' hspace='20' src='https://drive.google.com/uc?id=0B3hs6EXn55WUNzJmelk3cmRzcEE' />
### 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<IconTreeItem> {
...
@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)
没有合适的资源?快使用搜索试试~ 我知道了~
AndroidTreeView
共2005个文件
flat:998个
json:351个
xml:224个
需积分: 15 6 下载量 88 浏览量
2018-07-17
10:53:13
上传
评论
收藏 18.57MB ZIP 举报
温馨提示
AndroidTreeView 弹出某子结构时,并关闭已经弹出的其它子结构
资源推荐
资源详情
资源评论
收起资源包目录
AndroidTreeView (2005个子文件)
1+Ubr0QoatmtUWmCLe+E61QQ9ho= 208KB
1+Ubr0QoatmtUWmCLe+E61QQ9ho= 208KB
2Sp+d_8oSXOHqSoKvcFYQy6W45c= 356KB
library-debug.aar 36KB
resources-debug.ap_ 356KB
resources-debugAndroidTest.ap_ 305KB
resources-debugAndroidTest.ap_ 305KB
app-debug.apk 1.03MB
gradlew.bat 2KB
fileSnapshots.bin 2.26MB
classAnalysis.bin 566KB
fileHashes.bin 345KB
taskHistory.bin 279KB
jarAnalysis.bin 235KB
taskHistory.bin 169KB
taskJars.bin 21KB
resourceHashesCache.bin 19KB
last-build.bin 1B
built.bin 0B
bku6GoDIHzpnskHn3wwtN6t3AW0= 22B
bku6GoDIHzpnskHn3wwtN6t3AW0= 22B
CustomViewHolderFragment.class 21KB
TwoDScrollView.class 19KB
R$style.class 17KB
R$style.class 17KB
R$styleable.class 17KB
R$styleable.class 17KB
R$string.class 17KB
AndroidTreeView.class 16KB
R$styleable.class 15KB
R$styleable.class 15KB
R$styleable.class 15KB
R$style.class 15KB
R$style.class 15KB
R$style.class 15KB
R$attr.class 9KB
R$attr.class 9KB
R$attr.class 7KB
R$attr.class 7KB
R$attr.class 7KB
MyTestFragment.class 7KB
TreeNode.class 7KB
FolderStructureFragment.class 6KB
SelectableTreeFragment.class 5KB
TwoDScrollingArrowExpandFragment.class 5KB
ArrowExpandSelectableHeaderHolder.class 4KB
R$color.class 4KB
R$color.class 4KB
TwoDScrollingFragment.class 4KB
R$drawable.class 4KB
R$drawable.class 4KB
R$id.class 4KB
SelectableHeaderHolder.class 4KB
R$color.class 4KB
R$color.class 3KB
R$color.class 3KB
R$id.class 3KB
R$id.class 3KB
R$dimen.class 3KB
R$dimen.class 3KB
IconTreeItemHolder.class 3KB
R$drawable.class 3KB
R$drawable.class 3KB
R$drawable.class 3KB
SocialViewHolder.class 3KB
TreeNode$BaseNodeViewHolder.class 3KB
R$dimen.class 3KB
HeaderHolder.class 3KB
R$dimen.class 3KB
R$dimen.class 3KB
R$id.class 3KB
MainActivity.class 3KB
SelectableItemHolder.class 3KB
R$id.class 3KB
PlaceHolderHolder.class 3KB
ProfileHolder.class 3KB
MyTestFragment$2.class 2KB
MyTestFragment$3.class 2KB
MyTestFragment$4.class 2KB
MyTestFragment$1.class 2KB
R$layout.class 2KB
ArrowExpandSelectableHeaderHolder$2.class 2KB
TreeNodeWrapperView.class 2KB
MainActivity$1.class 2KB
SelectableHeaderHolder$1.class 2KB
R$layout.class 2KB
R$layout.class 2KB
SelectableTreeFragment$4.class 2KB
SingleFragmentActivity.class 2KB
AndroidTreeView$3.class 2KB
FolderStructureFragment$2.class 2KB
AndroidTreeView$2.class 2KB
FolderStructureFragment$1.class 2KB
IconTreeItemHolder$1.class 2KB
R$layout.class 2KB
ArrowExpandSelectableHeaderHolder$1.class 2KB
R$layout.class 2KB
SelectableTreeFragment$2.class 2KB
SelectableTreeFragment$3.class 2KB
R$string.class 2KB
共 2005 条
- 1
- 2
- 3
- 4
- 5
- 6
- 21
资源评论
粗糙的汉子
- 粉丝: 43
- 资源: 97
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功