我的自定义 ViewGroup 不会在 ScrollView 内滚动

发布于 2024-09-28 08:44:22 字数 150 浏览 0 评论 0原文

我扩展了 ViewGroup 来实现类似 FlowLayout 的功能。我将自定义 ViewGroup 放入 ScrollView 中,动态添加一堆内容,但它不滚动。流出屏幕的内容是不可见的。

我缺少什么,如何让我的 ViewGroup 与 ScrollView 兼容?

I've extended ViewGroup to achieve something like a FlowLayout. I put my custom ViewGroup into a ScrollView, dynamically add a bunch of content and it doesn't scroll. The content that flows off the screen is not viewable.

What am I missing, how can I allow my ViewGroup to be compatible with ScrollView?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦里人 2024-10-05 08:44:22

您的 ViewGroup 应该将其高度设置为 wrap_content 才能正常工作。这也意味着您需要正确实现 onMeasure() 才能为您的 ViewGroup 提供适当的高度。

Your ViewGroup should have its height set to wrap_content to work properly. This also means you need to implement onMeasure() properly to give your ViewGroup an appropriate height.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文