Android ExpandableListView 高度
我已将 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在 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.