开发者

How to implement multilevel expandable list view?

开发者 https://www.devze.com 2023-02-11 13:46 出处:网络
I need to implement multilevel expandable list view, something like ExpandableListView but with more than 2 levels.

I need to implement multilevel expandable list view, something like ExpandableListView but with more than 2 levels.

Now I use this data structure, but if need I can change it. It's not very important.

public class NodeList implements Set<NodeList>

public NodeList(String name) {
        mChilds = new ArrayList<NodeList>();
        mNodeName = name;
}

NodeList root = new NodeList("root");
    NodeList lv_1 = new NodeList("level_1");
    NodeList lv_2 = new NodeList("level_2");
    NodeList lv_3 = new NodeList("level_3");
    root.add(lv_1);
    root.add(lv_2);
    root.add(lv_3);

    NodeList lv_21 = new NodeList("level_21");
    NodeList lv_22 = new NodeList("level_22");
    lv_2.add(lv_21);
    lv_2.add(lv_22);

    NodeList lv_211 = new NodeList("level_211");
    lv_21.add(lv_211);

    NodeList lv_2111 = new NodeList("level_2111");
    NodeList lv_2112 = new NodeList("level_2112");
    lv_211.add(lv_2111);
    lv_211.add(lv_2112);

    NodeList lv_31 = new NodeList("level_31");
    NodeList lv_32 = new NodeList("level_32");
    NodeList lv_33 = new NodeList("level_33");
    lv_3.add(lv_31);
    lv_3.add(lv_32);
    lv_3.add(lv_33);

    NodeList lv_321 = new NodeList("level_321");
    lv_32.add(lv_321);`

Can anyone tell me which is better base view and which adapter to use? What methods needs to override? Maybe someone has already developed it, because this problem occurs qui开发者_如何学Cte often.

Please help.

Thanks for all response!


Check this http://code.google.com/p/tree-view-list-android/ ....

0

精彩评论

暂无评论...
验证码 换一张
取 消