|
Project Information
Links
|
IntroductionThis is a small widget that provides quite configurable tree view list. It is based on standard android list view. The widget is fully configurable - with your custom adapter you can provide your own implementation of the item views - even completely different implementation of item views depending on the tree level you are at. Implementation follows best approach of Adapters from android so views at the same tree level are reusable. ExamplesExample of trees :
UsageThe whole project can be included as external android library. After unsetting the "isLibrary?" flag, the project can also be compiled and installed on its own - providing demo application that presents capability of the widget. It shows how the tree behaves dynamically including explanding and collapsing nodes for many/all node, providing context menu for the tree, custom tree view with checkboxes only available for leaf nodes, custom colouring and different text sizes for text for different levels of the tree (albeit ugly) of the tree. The activity handling it is TreeViewListDemo.java, adapters used are SimpleStandardAdapter.java and extending it, colorful FancyColouredVariousSizesAdapter.java. Layout for tree items is defined in demo_list_item.xml. You can learn from the demo how to use the widget. The tree can be configured through XML layout file (attributes are defined in attrs.xml ). Example usage for demo application is in main.xml. It is most convenient to build your tree to display using TreeBuilder.java ArchitectureThe architecture separates out different aspects of the tree: there is a separate list view, tree adapter, tree state manager and tree state builder.
For now only in-memory state manager InMemoryTreeStateManager is provided, but Tree State Manger interface is done in the way that database tree manager even for large trees is potentially supported. |