Android ExpandableListView 高度

发布于 2024-11-28 13:30:02 字数 267 浏览 5 评论 0原文

我已将 ExpandableListView 添加到 Activity 中的 LinearLayout 中。在模拟器上,它显示为可滚动,并且高度仅与第一项(父项)一样大。我已将可滚动设置为 false,但我不知道如何将高度设置为与 ExpandableListView 中的项目集合一样大。如果父对象扩展,它也必须增长。如果太大,LinearLayout 可以滚动以查看其他项目。

有人有什么想法吗?

I have added an ExpandableListView to a LinearLayout in an Activity. On the emulator, it shows up as being scrollable and the height is only as big the first item (parent). I've set scrollable to false, but I don't know how to set the height to be as big as the collection of items in the ExpandableListView. It must also grow if a parent is expanded. If it's too big, the LinearLayout can be scrollable to view the other items.

Does anybody have any ideas?

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

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

发布评论

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

评论(1

简单爱 2024-12-05 13:30:02

您可以在 xml 中为 listView 提供自定义布局。它可以是文本视图或更复杂的布局,并且适用于父级和子级。您可以使用膨胀视图。在该布局中,您可以设置高度。

我不太确定你的问题:
如果太大,线性布局可以滚动以查看其他项目。
->>>那么为什么要把scrollable设置为false呢。

You can provide a custom layout for your listView in xml. It can be a textview or a more complex layout and that both for parent and children. You can use inflated views. In that layout you can set up the height.

I am not quite sure about your question:
If it's too big, the linearlayout can be scrollable to view the other items.
->>>so why do you want to put scrollable to false.

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