显示选项卡视图中递归名单 [英] Showing recursive lists inside a tab view

查看:311
本文介绍了显示选项卡视图中递归名单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

算法的问题在这里。

我创建一个应用程序,显示了一个法律文件,用制表符导航(TOC,书签等)。
里面的TOC标签,我需要显示的内容多表。在该TOC的叶,我需要展现一个TextView

I'm creating an app that shows a legal document, with tabs for navigation (TOC, bookmarks, etc). Inside the TOC tab, I need to show a multilevel table of contents. At the 'leaf' of the toc, I need to show a TextView

所以,我可以有:

TAB1:列表 - >列表 - >列表 - >列表 - >列表 - >的TextView

tab1: List -> List -> List -> List -> List -> TextView

TAB1:列表 - >列表 - >列表 - >的TextView

tab1: List -> List -> List -> TextView

TAB1:列表 - >的TextView

tab1: List -> TextView

根据不同的章,条,款,subsubsection这本书我展示的结构。

depending on the chapter, section, subsection, subsubsection structure of the book I'm showing.

现在,这不要紧,你是多么的深,TabHost需要总是preSENT,主要提供导航。 (是的,我问,我需要使用标签,而不是一个菜单)。

Now, it doesn't matter how deep you are, the TabHost needs to be ALWAYS PRESENT, to provide the main navigation. (Yes, I asked, and I need to use the tabs, not a menu.)

问题:

如何实现一个选项卡的FrameLayout里面的递归列表?或者我应该使用风格作为标签一个ListView,只是不能使用TabHost?

How do you implement the recursive List inside the FrameLayout of a tab? Or should I use a ListView styled as tabs and just not use the TabHost?

想法?

谢谢!结果
llappall

Thanks!
llappall

推荐答案

好吧。头号你不能把列表视图列表视图 ScrollViews GridView的或任何滚动为此事(即的ListView 项目无法的ListView )。它可能编译,它可能会运行,但结果不会是你所期望的或想要的。这是因为的ListView 不能被设置为 WRAP_CONTENT 的高度。

Okay. Number one you cannot put ListViews inside ListViews, ScrollViews, GridViews or anything scrollable for that matter (i.e. a ListView item cannot be ListView). It might compile, it might run, but the results will not be what you expect or want. This is because a ListView cannot have a height which is set to WRAP_CONTENT.

您可以有两个级别的列表( ExpandableListView ),但如果你需要比你将不得不自己实现的功能多层次延长的ListView ExpandableListView

You can have a two-level list (ExpandableListView) but if you require more levels than that you will have to implement the functionality yourself by extending ListView or ExpandableListView.

您也可以有分段列表,并且具有多个项目类型的列表,但没有办法使用默认SDK组件以获得一个5级列表

You can also have sectioned lists, and lists with multiple item types, but there is no way using the default SDK components to get a 5-level list.

号之二:是的,你可以有一个的ListView TabHost 。您将不能够使用 ListActivity ,但只是意味着你必须调用的ListView 方法直接:

Number two: Yes you can have a ListView inside a TabHost. You won't be able to use a ListActivity, but that just means you'll have to call the ListView methods directly:

ListView myList = findViewById(R.id.myList);
myList.setAdapter(myListAdapter);

而不是调用内置的 ListActivity 方法。

只要将你的的ListView 在布局文件中的的FrameLayout 。如果你有三个标签和的ListView 的FrameLayout ,那么它将被显示为内容中的第一个元素第一个选项卡。如果它是第二个元素,这将是对第二个选项卡等的内容。

Just place your ListView inside the FrameLayout in your layout file. If you have three tabs and the ListView is the first element inside the FrameLayout, then it will be displayed as the content for the first tab. If it is the second element, it will be the content for second tab and so on.

您可以实现与内置组件的递归列表是使用一个的ListView ,然后更改<$ C $的适配器的内容的唯一途径C>的ListView当用户选择一个项目(基本上是使用单一的ListView向下钻取菜单)。你也想​​需要捕捉与 onBack pressed 的返回按钮,以使用户能够浏览备份列表,或者某个地方提供一个后退按钮。

The only way you could implement a recursive list with inbuilt components would be to use a single ListView, and then change the contents of the adapter of the ListView when a user selects an item (essentially a drill-down menu using a single ListView). You'd also need to catch the back button with onBackPressed in order to allow the user to navigate back up the list, or provide a back button somewhere.

这篇关于显示选项卡视图中递归名单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆