如何在Android的多个列表视图 [英] how to create multiple list view in android

查看:218
本文介绍了如何在Android的多个列表视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建一个活动的多个列表视图?每个的ListView 应该有一个分离的头,它允许展开或折叠其名单和滚动任何的ListView 应滚动整个对于第一个的ListView活动(而不是一个滚动,另一个用于第二个的ListView 只有一个滚动对于的ListView ...)

How can I create multiple list views within a single activity? Each ListView should have a separated header which allows expanding or collapsing its list, and scrolling on any ListView should scroll the entire activity (NOT one scroll for first ListView and another for second ListView ONLY one scroll for BOTH ListView...)

列表视图动态填充...

listviews dynamically fills...

下面是一个类似的观点的截图:

Here's a screenshot of a similar view:

推荐答案

什么你所描述的是一个的 ExpandableListView

What you're describing is an ExpandableListView

要创建一个最简单的方法是通过改变XML你的ListView到 ExpandableListView 和使用的 ExpandableListAdapter SimpleExpandableListAdapter BaseExpandableListAdapter ,它的工作方式类似于其非扩展版本。

The simplest way to create one is by changing your ListView in XML to ExpandableListView and use one of the implementations of ExpandableListAdapter like SimpleExpandableListAdapter or BaseExpandableListAdapter, which work similarly to their non-expandable versions.

下面是一个例子从Android样本API,你可以下载使用SDK管理器。

Here's an example from the Android samples API which you can download using SDK Manager.

这篇关于如何在Android的多个列表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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