Open vinhgroup opened 6 years ago
I found a solution
1) you create a class like that
public class UtilityHolder {
public static void collapseOthers(TreeNode mNode, AndroidTreeView treeView){
if(mNode.isExpanded()) {
TreeNode parent = mNode.getParent();
for (TreeNode node: parent.getChildren()) {
if(node != mNode){
treeView.collapseNode(node);
collapseChildern(node,treeView);
}
}
}
}
private static void collapseChildern(TreeNode mNode, AndroidTreeView treeView) {
if (!mNode.getChildren().isEmpty()) {
for (TreeNode node : mNode.getChildren()) {
treeView.collapseNode(node);
collapseChildern(node,treeView);
}
}
}
}
2) you call the method collapseChildern in your Holder
@Override public void toggle(boolean active) { UtilityHolder.collapseOthers(mNode,treeView); }
i used this liblary. everything ok. but how to How to collapse other node expect current node clicked.
thanks in advance