gpt4 book ai didi

android - 在 ScrollView 中嵌套 ListView - 一个微妙的说明

转载 作者:太空狗 更新时间:2023-10-29 12:49:00 26 4
gpt4 key购买 nike

我读过很多帖子,指出 ListView 不应嵌套在 ScrollView 中。

我想知道这是否适用于一般的所有 AdapterView?

在为将嵌套在 ScrollView 中的自定义 ListView 编写了一大堆代码之后,在发现之前了解它会很有帮助。我想将它基于 AdapterView,以便我可以像使用标准 ListView 一样使用它(以帮助最大程度地减少我当前 ListView 相关代码的重写)。

谢谢。

最佳答案

I was wondering if this applies to all AdapterView's in general ?

总的来说,ScrollView 和其他 child 玩得不好。

It'd be helpful to know before finding out after writing a whole bunch of code for a custom list view that will be nested in a ScrollView.

没有必要将 ListView 放在 ScrollView 中。只需将 ScrollView 中的其他内容放入 ListView 本身,作为页眉/页脚 View ,或使用 my MergeAdapter ,或类似的技术。

I want to base it on an AdapterView so that I can use it similarly to a standard ListView

从头开始创建自定义 AdapterView 并不容易。如果您查看 ListView 及其直接父级 AbsListView 的源代码,就会发现有数千行代码。根据我前面的段落,将 ScrollView 的内容放入 ListView 会简单得多。

关于android - 在 ScrollView 中嵌套 ListView - 一个微妙的说明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14529376/

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