Skip to content

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

Notifications You must be signed in to change notification settings

mucrolores/MultiLevelListView

Repository files navigation

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.

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages