带有部分的 Android 自定义 ListView

标签 android android-layout

enter image description here 我想制作一个如下所示的 ListView。 ListItems 将被分组为多个部分,不同的部分具有不同的项目计数。我该如何开始??

注意我想要侧面的节标题。我可能还会提到这些项目是从数据库中查询的,部分现在是根据表中的列计算的。

最佳答案

我想我已经找到了您所需要的东西。 在我向您展示的这个特定示例中,您需要为 sectionItem 和 EntryItem 实现单独的适配器。

假设您知道如何处理适配器和 ListItems(使用您自己的 item.xml 定制),this is a full fledged tutorial for how to make sections and entries.(Solution #2)

在教程中,还给出了 xml 布局的代码,但您可以为该部分和条目项制作自己的自定义布局。它非常简单明了。

所以它会像这样脱落:

Custom ListView

关于带有部分的 Android 自定义 ListView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14931273/

相关文章:

javascript - 如何使用cordova在android中打开和关闭gps

java - Android 发布/订阅单例示例

android - 相对布局 : what's wrong with the baseline alignment?

android - 在具有固定宽度的 ImageView 中缩放图像

Android:不幸的是(项目名称)已停止工作

java - 如何将 Android 应用程序连接到 API 并在列表中显示数据?

java - 如何使用 Picasso [Android Studio] 从 facebook 获取个人资料图片

android - gboard 如何将 gif 和 emojis 作为键盘扩展集成到他们的键盘应用程序中

android - 将偏移监听器设置为 CollapsingToolbarLayout

android - android中的旋转问题