gpt4 book ai didi

android - 带有 ListView 子级的可滚动父级

转载 作者:行者123 更新时间:2023-11-30 04:53:25 25 4
gpt4 key购买 nike

我知道将 ListView 放置在滚动容器中被认为是禁忌,那么是否有任何“正确”的方法来完成其中具有 ListView 子容器的容器的滚动?示例布局如下所示:

Header
---
"Sub" header
---
ListView with list items
---
Footer

Header 和 Footer 需要在屏幕上保持静止,中间内容(Subheader 和 ListView)应该在它们之间滚动。我不能只有 ListView 可滚动,因为副标题占用了太多空间。目前,Header 来自 ,Subheader 包含多个 View ,包括图像和一些文本,ListView(实际上是 ViewFlipper 的一部分)将包含不确定数量的项目。页脚有几个按钮/选项卡,用于控制 ViewFlipper(只有脚蹼中的一个 View 是 ListView)。

我能想到的有效完成此操作的唯一方法是将 Subheader 作为第一项放在 ListView 中——有没有更好的方法?

最佳答案

I know it's considered taboo to place a ListView inside a scrolling container

这不是“禁忌”,只是永远行不通。

The only way I can think of to accomplish this efficiently would be to place the Subheader inside the ListView as the first item -- is there any better way?

您可以在 ListView 上使用 addHeader() 将您的“副标题”设置为 ListView 标题。

关于android - 带有 ListView 子级的可滚动父级,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1899576/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com