Skip to content

Latest commit

 

History

History
70 lines (43 loc) · 1.73 KB

README.md

File metadata and controls

70 lines (43 loc) · 1.73 KB

MultiLevelListView

Using customize BaseAdapter to adapter on origin listview, create a MultiLevel function Listview.

Preview

BasicPage

Features

  • support expand and collapse view items.

  • support edit title of the items(just click the pencil icon on target item row)

  • support add child node information

    BasicPage EditTitle AddChild

  • using File object to record the modified structure JSON string.

  • The adapter parse JSON string to build up the structure of listview

Classes

  • MainActivity
  • MultiLevelListViewItem
  • MultiLevelListViewAdapter

couples of styles and constants

Code Core

using single MultiLevelListViewItem as the root of structure tree

The object in MultiLevelListViewItem, tree node like data

public class MultiLevelListViewItem {
    private String title;
    private ArrayList<String> parentPath;
    private MultiLevelListViewItem parent;
    private ArrayList<MultiLevelListViewItem> children;
    private boolean expanding;
    private int depth;
}

using ArrayList to record displaying MultiLevelListViewItem

private ArrayList<MultiLevelListViewItem> showingItem;

notify the Adapter when Item clicked in the Activity

((MultiLevelListViewAdapter)listView.getAdapter()).updateView(position);

using Tree data structure to do the rename

some more details where in the code, hope this simple way to implement the MultiLevelListView help you out.