bmelnychuk / AndroidTreeView

AndroidTreeView. TreeView implementation for android
Apache License 2.0
3k stars 620 forks source link

Indentation problem #158

Closed dumbasPL closed 2 years ago

dumbasPL commented 6 years ago

test code:

        root = TreeNode.root();
        TreeNode xd1 = new TreeNode("test1");
        TreeNode xd2 = new TreeNode("test2");
        TreeNode xd3 = new TreeNode("test3");
        TreeNode xd4 = new TreeNode("test4");
        TreeNode xd5 = new TreeNode("test5");
        xd4.addChildren(xd3, xd2);
        xd2.addChild(xd1);
        root.addChildren(xd4, xd5);
        tView = new AndroidTreeView(getActivity(), root);
        layout.addView(tView.getView());

effect: screenshot_20180623-200257 Am i doing something wrong?

devendra2486 commented 6 years ago

Inside createNodeView method add below code (I am using frame layout as container)

FrameLayout.LayoutParams params= new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
            params.leftMargin = (node.getLevel()-1)*50;
            view.setLayoutParams(params);
MaggiWuerze commented 4 years ago

@devendra2486 solution is working as intended. this issue can be closed