如何在 Android 中创建树视图?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1944961/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 03:53:04  来源:igfitidea点击:

How to create a tree view in Android?

android

提问by Samuh

There are no controls in Android that provide Tree-like View. There is an ExpandableList View which I suspect could be used to creating one.

Android 中没有提供树状视图的控件。我怀疑有一个 ExpandableList 视图可以用来创建一个视图。

Have you tried imlpementing such a control? How would one implement such a control in Android?

您是否尝试过实施这样的控制?如何在 Android 中实现这样的控件?

采纳答案by Jarek Potiuk

Our company just open-sourced a small widget that is doing just that... You can see all the sources and add the project (as a library) to your own android project:

我们公司刚刚开源了一个小部件,它就是这样做的……您可以查看所有源代码并将项目(作为库)添加到您自己的 android 项目中:

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

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

回答by blacharnia

take a look at ExpandableListView. Besides, see following thread:

看看 ExpandableListView。此外,请参阅以下线程:

http://www.mail-archive.com/[email protected]/msg03587.html

http://www.mail-archive.com/[email protected]/msg03587.html

回答by lancha90

this solutions are, very complicate. but can use a ExpandableListView of more levels.

这种解决方案非常复杂。但可以使用更多级别的 ExpandableListView。

Example: How to implement multilevel ExpandableListview in Android?

示例:如何在 Android 中实现多级 ExpandableListview?